Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




BitmapData From Embedded Image?



Hey everyone,How would you fill a bitmapData with an embedded image?This is what I have so far. I've read the language reference, but I have no clue as to where to go from here.
Code:
// Embed images [Embed(source="texture.PNG")] private var Texture:Class; private function createBox(x:Number, y:Number, w:Number, h:Number, friction:Number, restitution:Number, static:Boolean, mode:uint, fill:Object):void { // Modes: 0 - solid fill, 1 - gradient fill, 2 - bitmap fill trace("function:createBox"); bodyDef = new b2BodyDef(); bodyDef.position.Set(x, y); boxDef = new b2PolygonDef(); var boxCenter:b2Vec2 = new b2Vec2(w, h); boxDef.SetAsOrientedBox(w, h, boxCenter); boxDef.friction = friction; boxDef.restitution = restitution; if (static) {boxDef.density = 0;} else {boxDef.density = 1.0;} bodyDef.userData = new Shape(); if (mode == 0) { bodyDef.userData.graphics.beginFill(fill); bodyDef.userData.graphics.lineStyle(0, 0x000000); bodyDef.userData.graphics.drawRect(0, 0, w, h); bodyDef.userData.graphics.endFill(); } else if (mode == 1) { } else if (mode == 2) { /// THIS IS WHERE THE PROBLEM STARTS /// var bitmapdata:BitmapData = new BitmapData(5, 5, false); bitmapdata.draw(fill); //bitmapdata.draw(Texture); doesn't work either bodyDef.userData.graphics.beginBitmapFill(bitmapdata); bodyDef.userData.graphics.drawRect(0, 0, w, h); bodyDef.userData.graphics.endFill(); } bodyDef.userData.width = w * 2 * 30; bodyDef.userData.height = h * 2 * 30; addChild(bodyDef.userData); body = m_world.CreateBody(bodyDef); body.CreateShape(boxDef); body.SetMassFromShapes(); }
It gives me an error that I cannot draw Classes or Objects into bitmapData, but I don't know what else I could do...Thanks for reading!



KirupaForum > Flash > ActionScript 3.0
Posted on: 12-02-2008, 04:44 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

[F8]copy BitMapData To Duplicate Image = Blurred Image?
I'm making a basic image gallery. I'm reading data about the files from xml which then creates thumbnails. I use the loadMovieClip class to load the images into the thumbnails (I'm loading the full size images but then reducing the size of them to look like thumbnails).

I have figured out how to use the BitMapData class to copy the images into cache so when you click on a thumbnail, it instantly appears, but the resulting larger image has pretty low quality. Is this a result of copying the BitMapData?

Also, I saw on another post that if you load an image once, it will be in your browser's cache so you wouldn't have to download it again. I'm wondering how well that works.

Also, GPARIS, if you read this, what method do you use on your site http://www.genevieveparis.com/client...iemacleod.html ?

I noticed it loads thuimbnail images up but the large images are instantly available and they are sharp/high quality. I thought I read in a post somewhere that you use the bitmap method, but couldn't find the post. If that's the case, is there something you do to make sure the bitmap data comes out sharp after copying? Awesome site by the way.

Thanks for any input.

Can You Draw Dynamic Textfield With Embedded Font Into BitmapData ("Offscreen")?
I need to set up a BitmapData/Bitmap that will have a number of dynamic textfields (fed by XML) drawn into it, but the drawing needs to occur while the textfields are off the display list (I will create them in AS3, "on the fly", then I will add the Bitmap to the display list.)

This seems to work fine, but I haven't gotten the embedded font to display correctly -- perhaps this is simply some font issue, but will the above work, i.e. will the embedded font be displayed correctly if I draw into the BMD "offscreen"

Can You Draw Dynamic Textfield W/embedded Font To BitmapData "Offscreen"?
I need to set up a BitmapData/Bitmap that will have a number of dynamic textfields (fed by XML) drawn into it, but the drawing needs to occur while the textfields are off the display list, then I will add the Bitmap to the display list.

This seems to work fine, but I haven't gotten the embedded font to display correctly -- perhaps this is simply some font issue, but will the above work, i.e. will the embedded font be displayed correctly if I draw into the BMD "offscreen"

Load Image Into Bitmapdata
Hi

I am loading bitmapdata from the library like this

linkageId = "landscape";
myBitmapData = BitmapData.loadBitmap(linkageId);

Than attach this bitmap image to a movie.

mc = this.createEmptyMovieClip("mc", 0);
mc.attachBitmap(myBitmapData, 0);

Can someone give me the code to load my image using loadMovie instead of from libarary and attach it to movie clip mc.

Loading Image Into Bitmapdata
Hi

I am loading bitmapdata from the library like this

linkageId = "landscape";
myBitmapData = BitmapData.loadBitmap(linkageId);

Than attach this bitmap image to a movie.

mc = this.createEmptyMovieClip("mc", 0);
mc.attachBitmap(myBitmapData, 0);

Can someone give me the code to load my image using loadMovie instead of from libarary and attach it to movie clip mc.

BitmapData Of On-stage Image?
If I have a bitmap, let's say a .png, on the Stage at compile time (as opposed to instantiating it), is there a way to access the .png's BitmapData? Many thanks.

Can You Export An Image From BitmapData
Once you have done fun stuff with BitmapData in Flash 8 is there anyway you can export the image back to a server as a JPEG or PNG?

TIA

Kevin

Image Transperancy In BitmapData
Folloing are the excerpts of my code in AS2:
I have image1 as and image2 on my stage. The image2 is a transparent GIF and works good transparantly when moved, roatated etc. this image2 is merged over image1 on a button click instance.
Problem with the source is that as soon as the image is merged it (image2) looses its transparancy and converted to opaque again. How to resolve this issue?








Attach Code

on (press) {
import flash.display.BitmapData;
import flash.geom.Matrix;
import flash.geom.Point;
import flash.geom.Rectangle;
import flash.geom.ColorTransform;

var bmp1:BitmapData = new BitmapData(int(_parent.m1w.text), int(_parent.m1h.text), false, 0x00FFFFFF)
bmp1.draw(_parent.m1, new Matrix());

var bmp2:BitmapData = new BitmapData(int(_parent.m2w.text), int(_parent.m2h.text), false, 0x00FFFFFF);
bmp2.draw(_parent.m2, new Matrix());

var bmpmrgd:BitmapData = new BitmapData(int(_parent.m1w.text)+100, int(_parent.m1h.text), false, 0x00FFFFFF);
bmpmrgd.merge(bmp1, new Rectangle(int(_parent.m1x.text)-40, int(_parent.m1y.text)-10, int(_parent.m1w.text), int(_parent.m1h.text)), new Point(int(_parent.m1x.text), int(_parent.m1y.text)), 250, 250, 250, 100);
bmpmrgd.merge(bmp2, new Rectangle(0, 0, int(_parent.m2w.text), int(_parent.m2h.text)), new Point(int(_parent.m2x.text), int(_parent.m2y.text)), 250, 250, 250, 100);

_parent.createEmptyMovieClip("mrgdclip", _parent.getNextHighestDepth());
_parent.mrgdclip.attachBitmap(bmpmrgd, mrgdclip.getNextHighestDepth());

_parent.m1._visible = false;
_parent.m2._visible = false;
_parent.m1x._visible = false;
_parent.m1y._visible = false;
_parent.m1w._visible = false;
_parent.m1h._visible = false;
_parent.m2x._visible = false;
_parent.m2y._visible = false;
_parent.m2w._visible = false;
_parent.m2h._visible = false;
_parent.b1._visible = false;
}

Image File To BitmapData
Im doing this game as final project for graduation and I want all imagery available and dynamicly loadable from a directory without a need to have it all imported into a library.

So is there a way to load external image and convert it to BitmapData or get its content at pixel level?

[edit]Cause I dont see any. If I load it with loadMovie, it becomes content of a MC and I dont know af any functionality to work with a MC as with a bitmap and any other loading method is not know to me too.[/edit]

BitmapData Of On-stage Image?
If I have a bitmap, let's say a .png, on the Stage at compile time (as opposed to instantiating it), is there a way to access the .png's BitmapData? Many thanks.

Loading Image Into Bitmapdata
Hi

I am loading bitmapdata from the library like this

linkageId = "landscape";
myBitmapData = BitmapData.loadBitmap(linkageId);

Than attach this bitmap image to a movie.

mc = this.createEmptyMovieClip("mc", 0);
mc.attachBitmap(myBitmapData, 0);

Can someone give me the code to load my image using loadMovie instead of from libarary and attach it to movie clip mc.

Image Class Using BitmapData?
Can someone explain what is going wrong with this simple class:


ActionScript Code:
class image extends MovieClip {
    public var bmd:flash.display.BitmapData;
   
    public function image() {
        super();
    }
    public function loadImage(p_url:String, p_loader:MovieClipLoader) {
        if (p_url) {
            var loadURL:String = p_url;
        } else {
            var loadURL:String = "/img/"+this._name+".jpg";  //default image location if no URL provided
        }
        if (p_loader) {
            var imageLoader = p_loader;
        } else {
            var imageLoader = new MovieClipLoader();
            trace("making my own loader");
        }
        imageLoader.addListener(this);
        var loadTarget = this.createEmptyMovieClip("loadTarget", this.getNextHighestDepth()); //temporary holder
        imageLoader.loadClip(loadURL, loadTarget);
    }
    function onLoadInit(targetMC:MovieClip) {
        trace("loading complete on "+targetMC);
        var imgWidth:Number = targetMC._width;
        var imgHeight:Number = targetMC._height;
        this.bmd = new flash.display.BitmapData(imgWidth, imgHeight, true, 0x00000000);
        this.bmd.draw(targetMC);
        this.attachBitmap(this.bmd);
        targetMC.removeMovieClip();
        this._x -= this._width/2;
        this._y -= this._height/2;
        this._parent.imageLoadComplete(this);
    }
    function onLoadStart(targetMC:MovieClip) {
        trace("loading started on "+targetMC);
    }
}


In my library, I have a MovieClip symbol defined type of image and exported in the first frame.

If I don't removeMovieClip(targetMC), I can see that my image loads fine. But when I removeMovieClip, it disappears?

Any help would be greatly appreciated.

Jase

BitmapData Image Resize Does It Have To...
I am creating an environment in my Flash using images as the background. I know how to use the BitmapData to resize images to fit to my screen, but the only way to do this (that I know of) is to load the image into Flash from the library or externally. In this case I would like the images to be in a MC, because I will be animating them with other images and have other animations on top of them. Is there a way to use the BitmapData to fix the scaling image issue in Flash without having to load the images from the Library or externally?

From External Loaded Image To Bitmapdata?
Hey again

I have looked around the forum for a while, but haven't found an answer...
I am loading an external JPG using the Loader class.

And I have this code, that can be used to make a tiled background:

Code:
var backGroundSprite:Sprite = new Sprite();
backGroundSprite.graphics.beginBitmapFill(bitmap);
backGroundSprite.graphics.drawRect(0, 0, stage.stageWidth, stage.stageHeight);
backGroundSprite.graphics.endFill();
addChild(backGroundSprite);
I have tried converting the loaded image into a bitmapdata object, but I just can't figure it out. How do I do this?


*************** edit*************
I figured it out with the help of the Flash CS3 help, under the "Bitmap" class:


Code:
var image:Bitmap = Bitmap(myloader.content);
var bitmapData:BitmapData = image.bitmapData;

Dynamically Load An Image To A Bitmapdata
Hi, is there a way to create a bitmapdata from a dynamically loaded jpg or png? I'm searching the documentation and the web and I can't find anything related to this. It seems we can only import images from the library with the BitmapData.loadBitmap method.

Smoothly Resizing An Image By BitmapData
Hello.

I never used BitmapData before but I understand it can be used to smoothly re-size an image.
Does anyone has a code block sample to re-size an image?
I want to smoothly scalle images without having that bad look that it has when an image was scalled inside flash.

Thank you.
- Adrian.

Loading Image Into Bitmapdata Using Loadmovie
Hi

I am loading bitmapdata from the library like this

linkageId = "landscape";
myBitmapData = BitmapData.loadBitmap(linkageId);

Than attach this bitmap image to a movie.

mc = this.createEmptyMovieClip("mc", 0);
mc.attachBitmap(myBitmapData, 0);

Can someone give me the code to load my image using loadMovie instead of from libarary and attach it to movie clip mc.

Tiling An Image Using BitmapData.draw()
I'm loading in a large external swf image, and trying to cut it up into stage-sized chunks using BitmapData.draw() with a clipRect parameter, then draw those chunks back onto the stage, essentially producing the same-looking image as the swf.

However, the only thing that is drawing is the first chunk (the one that would appear at 0, 0). The rest are just coming out blank (but in the right spot on the grid).

Here's my code. Anyone know what the problem is?


Code:
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete);
loader.load(new URLRequest("midgroundBack.swf"));

var tileArray:Array = [];

function onLoadComplete(event:Event):void
{
var l:Loader = event.target.loader as Loader;

var stageWidth:Number = stage.stageWidth;
var stageHeight:Number = stage.stageHeight;
var nColumns:Number = Math.ceil(l.width / stageWidth);
var nRows:Number = Math.ceil(l.height / stageHeight);
trace("Column count: " + nColumns);
trace("Row count: " + nRows);
for (var i:int=0; i<nRows; i++)
{
tileArray[i] = [];
for (var j:int=0; j<nColumns; j++)
{
var rect:Rectangle = new Rectangle(j*stageHeight, i*stageWidth, stageWidth, stageHeight);
var bd:BitmapData = new BitmapData(stageWidth, stageHeight, true, 0x00000000);
bd.draw(l, new Matrix(), new ColorTransform(), "normal", rect);
var bitmap:Bitmap = new Bitmap(bd);
var sprite:Sprite = new Sprite();
sprite.addChild(bitmap);
tileArray[i][j] = sprite;
sprite.x = j * stageWidth;
sprite.y = i * stageHeight;
addChild(sprite);
trace("X: " + sprite.x + ", Y: " + sprite.y);
}
}
}
Essentially, I'm trying to get a grid of stage-sized images rather than one large image.

Thank you,
Eric Smith

Using BitmapData To Display An Image Inside An XML File?
I posted about this already, but I thought I would make this more clear. I'm starting to come to the conclusion that this just can't be done in ActionScript 2.0.

I have a image lets say it's a JPG and I've been able to put it into an array. For example


Code:
import flash.display.BitmapData;

var str:String = "R0lGODlhDwAPAP..."; //Goes on and on

str = Base64.decode( str );

var mc:MovieClip = _root.createEmptyMovieClip( "myclip", 10 );
mc._x = 100;
mc._y = 100;

var bmap:BitmapData = BitmapData.loadBitmap( str );
mc.attachBitmap( bmap, 0 );
So Obviously BitmapData.loadBitmap( str ) Does not work. But is there a way to get otherwise loaded binary image data into a BitmapData object so that it can be used to attachBitmap and be shown?

Thanks,

Smoothly Resizing An Image By BitmapData Is Not Always Work
I have successfully using the following to do the smoothing of external jpg image. e.g. (from 700x525 to 350x262)
1) Load image into a movie clip
2) create a BitmapData object the size of the image in the movie clip
3) use the BitmapData.draw() method to "draw" the image bits from the movie clip into the BitmapData object.
4) Use MovieClip.attachBitmap() to attach the bitmap to a the movieclip that you will be using for your display.

BUT, if I try to scale down a jpg image from 700X525 to even smaller 160x120.....distortion appear again...
Is that we cannot make a perfect and smooth thumbnail from large image?

Really hope that any expert could help thius. thanks

Load Image Into BitmapData Object Dynamically?
I don't know if "dynamically" is the right term, but here's my question:

If I have an XML file that lists the URLs of images (jpegs) that I want to import, is there a way to do load them into BitmapData objects?

I know you can do it if the images are already imported and linked in the library with an identifier...

Loading An Image Into A MovieClip, Then Into BitmapData [renamed]
Hello,

I am trying to load an image into a movieclip and then draw the contents of the movieclip to a bitmapData object. Below is some sample code.


Code:
target.jpg_mc.loadMovie(url);
target.createEmptyMovieClip("loader_mc", 100);
target.loader_mc.bmc = target.jpg_mc; // movieclip where to load original image
target.loader_mc.tmc = target.bmp_mc; // movieclip with smoothed image
target.loader_mc.onEnterFrame = function(){

bl = this.bmc.getBytesLoaded();
bt = this.bmc.getBytesTotal();
if (bl >= bt && bt > 4 && this.bmc._width > 0 && this.bmc._height > 0){
//target._parent._visible = true;

this.bmc._visible = false;

var bitmap = new BitmapData(this.bmc._width, this.bmc._height, true);
this.tmc.attachBitmap(bitmap, 100,"auto", true);
bitmap.draw(this.bmc);

Stage.addListener(target);

target.gotoAndPlay("in");
this.removeMovieClip();
}
}
For some reason it always draws a white box rather than the image. Has anyone ever seen this happen with the bitmapData class?

Thanks for any help!

Wade

BitmapData Image Manipulation And Duplicate Movie
I have a question about "Bitmap image manipulation". The file I am working with is the second one listed here. http://www.brendandawes.com/sketches/piecesof8/
I am having trouble getting the code to work when I am duplicating a movie and then attaching it to the "bitmap manipulation code". I think it may be because the duplicated movieclips end up with names like "_level0.promoContainer.p1". Thanks.


ActionScript Code:
loop = 1;
while (loop<=totalPromos) {
    promoContainer.p.duplicateMovieClip("p"+loop, loop);
    newCont = eval("promoContainer.p"+loop);
    newClip = eval("promoContainer.p"+loop+".promo");
    if (loop != 1) {
        newCont._visible = false;
    }
    // load jpg's 
    newClip.loadMovie(promos[loop].path);
    ++loop;
}
 
po = _level0.promoContainer.p1;
import flash.display.BitmapData;
import flash.geom.Rectangle;
import flash.geom.Point;
myBitmap = new BitmapData(po._width, po._height, true, 0);
myBitmap.draw(this.po);
var myBitmapBlur:BitmapData = myBitmap.clone();
blurMe(myBitmapBlur);
var myBitmapOriginal:BitmapData = myBitmap.clone();
function blurBitmap(target:BitmapData) {
    var myfilter = new flash.filters.BlurFilter(8, 8, 2);
    target.applyFilter(target, target.rectangle, new Point(0, 0), myfilter);
}
function copy(xPos:Number) {
    rect = new Rectangle(0, 0, xPos, myBitmap.height);
    blurBitmap(myBitmap);
    myBitmap.copyPixels(myBitmapOriginal, new Rectangle(xPos, 0, myBitmap.width-xPos, myBitmap.height), new Point(xPos, 0));
    po.attachBitmap(myBitmap, 1, "auto", true);
}
this.onEnterFrame = function() {
    copy(po._xmouse);
};

Camera-data To A BitmapData-array - Small Image?
Hello all,

I capture the camera-data to a BitmapData-array. Then use php to save this into a jpeg. This worked for me previously but now it seems to save the image but there is a lot of white space around it. Can someone help me troubleshoot this. Here is a snippet of my code:


ActionScript Code:
var cam:Camera = Camera.getCamera();  // our camera object.
var iFps = cam.fps;
cam.setMode(640, 480, iFps);
cam.setQuality(0,100);

myvideoobject.attachCamera(cam);

var foo:BitmapData = new BitmapData(640,480);
foo.draw(myvideoobject); // this will capture the camera-data to this BitmapData-array

Thanks all

Write Visible Part Of Masked Image To Bitmapdata?
the idea is - a dynamically loaded image is loaded into a movieclip and masked so that just a small area of the entire thing is visible... is there a way to copy that visible area into another movieclip? can it be done with bitmapdata?

Dynamic Image Resize + BitmapData Smoothing = Problem
Hello, I'm brand new to the forums here. I'm okay at actionscript, but honestly everything I'm trying to pull off is beyond me so the fact that I've gotten as far as I have is kind of a feat in itself. Anyway, I'm creating a dynamic image gallery that resizes the images to fit the gallery size, and then smooths them out.

I feel like I'm super close to getting it to work perfectly. The image smoothing always works, but the resizing is kind of iffy. The first image displayed will resize just fine, but when you view any others they're all distorted or squashed. What's strange is that I've traced out the resized image dimensions and they're exactly what they should be, but the images are still not resizing correctly.

Here's my code! I only included the parts of it that are really relevant, but let me know if you guys want to see all of it. It's a combination of a few tutorials that I found. I may be able to provide a live example, but it's for work so I'm not sure how the nondisclosure agreement would affect that.

Thank you so much in advance!


Code:
var thisWidth:Number;
var thisHeight:Number;
var maximumHeight:Number;//height to which movieclip to be resized
var maximumWidth:Number;//width to which movieclip to be resized
var oldx:Number;
var oldy:Number;
var ratio:Number;
var mclis:Object = new Object();//An object that listens for a callback notification from the MovieClipLoader event handlers.


function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
picture._alpha = 0;
loadBitmapSmoothed(image[p], picture);
slider.cap_txt.text = "Photo By: " + author[p];
slider.desc_txt.text = caption[p];
header_txt.text = header[p];
picture_num();
trace(current_pos);
if (sliderval == 1){
var xPosT:Tween = new Tween(slider, "_y", Regular.easeOut, slider._y, 235, .5, true);
sliderval = 0;
}
}
}
}
function lastImage() {
//p++;
p = total-1;
picture._alpha = 0;
loadBitmapSmoothed(image[p], picture);
slider.cap_txt.text = "Photo By: " + author[p];
slider.desc_txt.text = caption[p];
header_txt.text = header[p];
picture_num();
trace(current_pos);
if (sliderval == 1){
var xPosT:Tween = new Tween(slider, "_y", Regular.easeOut, slider._y, 235, .5, true);
sliderval = 0;
}
}
function prevImage() {
if (p>0) {
p--;
picture._alpha = 0;
loadBitmapSmoothed(image[p], picture);
delete _root.mc;
slider.cap_txt.text = "Photo By: " + author[p];
slider.desc_txt.text = caption[p];
header_txt.text = header[p];
picture_num();
trace(current_pos);
if (sliderval == 1){
var xPosT:Tween = new Tween(slider, "_y", Regular.easeOut, slider._y, 235, .5, true);
sliderval = 0;
}
}
}
function firstImage() {
if (loaded == filesize) {
picture._alpha = 0;
loadBitmapSmoothed(image[0], picture);
slider.cap_txt.text = "Photo By: " + author[0];
slider.desc_txt.text = caption[0];
header_txt.text = header[0];
picture_num();
if (sliderval == 1){
var xPosT:Tween = new Tween(slider, "_y", Regular.easeOut, slider._y, 235, .5, true);
sliderval = 0;
}
}
}

function picture_num() {
current_pos = p+1;
pos_txt.text = current_pos+" / "+total;
}

/////////////////////////////////////

function loadBitmapSmoothed(url:String, target:MovieClip) {

// Create a movie clip which will contain our unsmoothed bitmap
var bmc:MovieClip = target.createEmptyMovieClip("bmc",target.getNextHighestDepth());

// Create a listener which will notify us when the bitmap loaded successfully
var listener:Object = new Object();
// Track the target
listener.tmc = target;

// If the bitmap loaded successfully we redraw the movie into
// a BitmapData object and then attach that BitmapData to the target
// movie clip with the smoothing flag turned on.
listener.onLoadInit = function(mc:MovieClip) {
bitmap.dispose();
_root.thisHeight = mc._height;//loaded movieclip height
_root.maximumHeight = 500;
_root.thisWidth = mc._width;//loaded movieclip width
_root.maximumWidth = 304;

ratio = thisHeight/thisWidth;//calculation ratio to which resize takes place


if (thisWidth>maximumWidth) {
//picture._x = 143-(thisWidth/2);
thisWidth = maximumWidth;
thisHeight = Math.round(thisWidth*ratio);
width_txt.text = thisWidth;
height_txt.text = thisHeight;
}
if (thisHeight>maximumHeight) {
//picture._x = 143-(thisWidth/2);
thisHeight = maximumHeight;
thisWidth = Math.round(thisHeight/ratio);
width_txt.text = thisWidth;
height_txt.text = thisHeight;
}

picture._width = thisWidth;//applying new width
picture._height = thisHeight;//applying new height
//picture._xscale = 60;
//picture._yscale = 60;
//picture._y = -20;

mc._visible = false;
bitmap = new BitmapData(mc._width, mc._height, true);
this.tmc.attachBitmap(bitmap, this.tmc.getNextHighestDepth(),"auto", true);
bitmap.draw(mc);

};

var loader:MovieClipLoader = new MovieClipLoader();
loader.addListener(listener);
loader.loadClip(url, bmc);

// var mcl:MovieClipLoader = new MovieClipLoader();//MovieClipLoader class lets you implement listener callbacks that provide status information while SWF, JPEG, GIF, and PNG files are being loaded into movie clips.
// mcl.addListener(mclis);//add the object as listener for event handlers
// _root.createEmptyMovieClip("holder_mc", _root.getNextHighestDepth());//holder movieclip
// _root.mcl.loadClip("http://www.atpm.com/11.02/nature/images/blue-flower.jpg", _root.holder_mc);//You can use the loadClip() method to load one or more files into a single movie clip or level;


};

Stretching Image To Size Of Browser Using BitmapData Class And Dawing Api
Ive been working from a great tutorial found at http://www.gotoandlearn.com/download.php on creating full browser flash. It uses the BitmapData class and drawing api to attach an image to the stage and have the image tile when the browser window is resized. The problem is that I want my image to stretch to fit the browser window instead of tile.

I've looked into alternatives on attaching my image to a movieclip and having the mc resize, but thats no good since I'm using the drawing api to draw other elements on the background. The movieclip then covers those other elements.

Any ideas?

import flash.display.BitmapData;

var bgImage:BitmapData = BitmapData.loadBitmap("bgImage");

function fillBG() {
this.beginBitmapFill(bgImage);
this.moveTo (0,0);
this.lineTo (Stage.width,0);
this.lineTo (Stage.width, Stage.height);
this.lineTo (0, Stage.height);
this.lineTo (0,0);
this.endFill ();

}

fillBG();

var stageListen:Object = new Object();
stageListen.onResize = function() {
fillBG();
}

Stage.addListener(stageListen);







Attach Code

import flash.display.BitmapData;

var bgImage:BitmapData = BitmapData.loadBitmap("bgImage");

function fillBG() {
this.beginBitmapFill(bgImage);
this.moveTo (0,0);
this.lineTo (Stage.width,0);
this.lineTo (Stage.width, Stage.height);
this.lineTo (0, Stage.height);
this.lineTo (0,0);
this.endFill ();

}

fillBG();

var stageListen:Object = new Object();
stageListen.onResize = function() {
fillBG();
}

Stage.addListener(stageListen);

BitmapData Expert Required: Transition Between Two Alpha Channel For A Target Image
Hi there,

I'm working on a transition of alpha channel in a target image.

I have one target image and two kind of alpha channel bitmap between which I'm making my transition. The whole works great but unfortunately after having done numerous time the transition back and forth the target image become "burned"... as anyone an idea about it?

Please look at the attachement, I've described precisely my problem in it...

Thank you very much in advance!

BitmapData::draw(BitmapData) Doesn't Seem To Support Alpha Channels
Hi all,

I have a BitmapData object with alpha channels, bm1, and would like to draw it into another BitmapData object, bm2. While I can draw bm1 into bm2, alpha channels do not seem to work. Here is some code to illustrate what I'm trying to do:

// create an all-green but semi-transparent BitmapData object (all alphas are set to 0x80 in the constructor)
var bm1:BitmapData = new BitmapData(100, 100, true, 0x8000FF00);

// create an all-white BitmapData object and display it
var bm2:BitmapData = new BitmapData(100, 100, true);
addChild(new Bitmap(bm2));

// draw bm1 into bm2 in the onTimer() callback function
bm2.draw(bm1);

I would expect bm2 to be light-green, because it's semi-transparent, but it's 100% green, i.e., 0xFF00FF00.

I already tried all blend modes, but blend modes didn't make a difference.

Any ideas?

Btw, what I'm trying to do is to extract an arbitrary collection of pixels (as opposed to a rectangle) from a bitmap (bm1) by copying it into another bitmap (bm2) and using alphas of 0x00 and 0xff to select the pixels to be extracted. Is there a better way to do this? (or any way for that matter? ;-)

Thanks!


-Bernd

Links Embedded In Image
i'm totally new to flash. i want my site to be one picture where i can make diffirent parts of the picture diffirent links. for instance the pic posted below is the whole website. when you click the left eye you link to audio, right eye to pics, the nose is the link to contact page etc. is there a tutorial available for this? is it hard to do ? thanks in advance

360 Image Embedded In Flash
i already have the file of the 360 pic. It is in a quicktime movie format. My problem is that when i embed this only one pictureee shows up and when move the mouse in it it doesn't work...
is there an action script for this. or am i doing it all wrong

360 Image Embedded In Flash
i already have the file of the 360 pic. It is in a quicktime movie format. My problem is that when i embed this only one pictureee shows up and when move the mouse in it it doesn't work...
is there an action script for this. or am i doing it all wrong

Embedded Image In Textarea
i've been searching all over for a solution to this problem. simply, when you embed an image into the textArea class (via img tag), how do i go about attaching code to it? in a dynamic text box, this works:

Code:

// "test" is a dynamic text field on stage
test.html = true;
test.htmlText = 'image: <img src="image_link_identifier" id="image_mc">';

test.image_mc.onRelease = function() {
   trace(this);
   if (this._currentframe == 1) {
      test.image_mc.gotoAndStop(2);
   } else {
      test.image_mc.gotoAndStop(1);
   }
}

simple enough.

doing this in a textArea component, however, does not work.

Code:

// "test_ta" is a textArea component on stage
test_ta.html = true;
test_ta.text = 'image: <img src="image_link_identifier" id="image_mc">';

test_ta.label.image_mc.onRelease = function() {
   trace(this);
   if (this._currentframe == 1) {
      test_ta.image.flag_mc.gotoAndStop(2);
   } else {
      test_ta.image.flag_mc.gotoAndStop(1);
   }
}

for some reason, the handler is "attached" (hand cursor shows) but the code will not execute.

i use test_ta.label.image_mc instead of test_ta.image_mc because the actual text field in a textArea is test_ta.label.. where the mc resides.

any thoughts?

i'm using old-school flash mx pro 2004. no 8 yet :(

Links Embedded In Image
i'm totally new to flash. i want my site to be one picture where i can make diffirent parts of the picture diffirent links. for instance the pic posted below is the whole website. when you click the left eye you link to audio, right eye to pics, the nose is the link to contact page etc. is there a tutorial available for this? is it hard to do ? thanks in advance

URL

Embedded Image Won't Display
Hello,

I'm trying to create a flash movie that's basically a wrapper for various html pages. Is it possible to embed entire HTML pages in dynamic text boxes? I started by trying to embed a random JPEG image into a dynamic multiline (wrapped) text box, and it loads but doesn't display in the box. It is definately smaller than the text box. Why is this so?

Embedded Image Dissappearing From Projector
Hi-
I originally posted in the MX forum, but this is probably more appropriate...

I am embedding an image in a text field, using the standard <img> tag.

blah, blah, blah<img src="images/01summary01.jpg" width="544" height="252">blah, blah, blah...

The image exists in a folder called "images", one level down from the flash file. The text content (including the <img> tag) is called in from an xml file.

Everything works fine and the image displays properly when I run the file as a .swf file, but I am trying to create a demo version of the app as a windows projector and when I view it in the .exe, the image no longer displays.

Anyone seen this before, or have any suggestions?
Thanks!

Accessing An Embedded Image In A Loaded Swf
Dear all,

I am loading a swf which contains a mc and an image with a class defined. I got not problems passing the mc to a container of my main movie but I do not know how to access the image class. In a preview test, with the image embedded in my main mc, I just did something like this:

var myImage:ClassName = new ClassName(100,100);
var imageBitmap:Bitmap = new Bitmap(myImage);

but now I do not know how to do the same action.

Thanks in advance

Embedded Html, Image Link
so my image link was working, but I noticed when you click the image a bunch of text got selected.. so i made the text box not selectable.. and now the image link doesn't work.. you get the hand.. but no link.. yet the text links work fine... any ideas?

all i am doingis this


Code:
<span class='contactimage'><a href="http://www.google.com"_blank"><img align="right" src="Images/Chicago.png" /></a></span>

[F8] Embedded Image Within Dynamic Text Field
i am using flash 8 and have a dynamic text field - multiline, html rendered - it loads text from my external text file successfully. It also links to an external style sheet and displays everything correctly.

now i am trying to include an image to be displayed within my dynamic text field. the code that I insert into my text file is:
[
<img src="images/mytestimage.jpg" width="194" height="300" align="left" />
]

The image successfully displays EXCEPT it displays partially OUTSIDE of the actual textfield.

What am I doing wrong? The image not only "hangs" out over the left side/border of the textfield, but it also has too much blank space to it's right - basically the same amount of "padding" equal to the amount of space the image hangs over the left side/border of the textfield.

Can anyone help? thank you.

Position Image Embedded In Dynamic Textfield
Hi all,

Well after searching through the net and forums here and not finding any answer about my query I'm posting it over here.

I have a dynamic text field called a_txt on stage.
And following code

Code:
a_txt.html=true;
a_txt.htmlText="<p>Currently there exists a temporary <p><img src='ico.jpg' height='25px' width='25px'></p>setup to compile the documents in to a self running CD (flash presentation).
So basically I'm embedding an image in the dynamic textfield, which is html enabled using img tag.

However the img sticks either to the left or right border of the textfield (by using align attribute of img).

But if I want to place the image anywhere between the text, tht's not possible.




can anybody help?

Thanks

Can You Preload An Embedded Swf In To A Html Webpage As You Would An Image?
I am creating a site for a client, www.idsvehicles.co.uk

I want to preload the embedded swf's as you would images using javascript or css. I have so far been unsuccessful. I am trying to avoid having the great big white patches in the site while the menu or stocklist(on the stocklist page) load, and id prefer not to have a loading bar while it does. If possible id like to have all images and swf's loaded and cached before the page is displayed so it appears seemingly instantly. Is this possible?

I first attempted to do this with a standard image preloading javascript and failed. Is it at all possible to preload swf's with javascript, if not what are my options?

Thanks in advance.

P.S. I am fairly new to the site, i only discovered it a few days ago. Its an absolutely fantastic resource and has already helped me out massively, so thank you to all, especially those involved with the tutorials. Superb!

HTML Text With Embedded Image - Reduce Margin?
I've set up a dynamic text field to receive html formatted text. I've also created a CSS object to style it a bit. It works fine.

I want to embed a jpg in the html text and that works fine as well but the text wraps around the image with a larger margin than I would like. Is there any way to reduce the margin around the image, especially the top an bottom?

Any tips are appreciated.

[as3] Drawing BitmapData To Erase BitmapData
Hey there. I'm still working on my paint program, and I figured I'd try using the open source, raster-based drawing system from Bytearray.org to speed up drawing in some of my paint tools. The Raster class has some drawing functions that don't bother with anti-aliasing, so in some situations, implementing these methods results in faster code than relying on the Graphics package. I've gotten a nice speed boost from my rainbow paintbrush, which is pretty neat. Go open source!

Unfortunately, I can't get the eraser brush to work, even though its code is essentially the same as the other brushes'. And I've figured out why; the "erase" and "alpha" blend modes, which my vector-based eraser uses to erase the drawing surface, don't seem to work when you draw one BitmapData object onto another. I could put the BitmapData in a Bitmap object and draw that, but that's essentially converting raster data to vector, and then back to raster, which is far slower than any speed improvement I'd get from relying on the Raster class in the first place.

Has anyone here succeeded in using one BitmapData object to erase another, without "wrapping" the eraser BitmapData in a Bitmap object?

Dynamic Textfield - Embedded Font - Embedded Characters Problem
Hi everyone,
In AS in flash 8, i'm doing the following : a font "Garamond" in my library,creating a textfielda textformat that is used on my textfieldi define the characters that should be embedded...
This last point doesn't seem to work...
This is my code (you can also check my fla) :

--
var myFormat = new TextFormat();
myFormat.font = "Garamond";
myFormat.size = 20;
myFormat.color = "0xFFFFFF";

createEmptyMovieClip("myContainer",10);

myContainer.createTextField("myText", 11, 0,0,400,500);
myContainer.myText.border=true;
myContainer.myText.autoSize = true;
myContainer.myText.html = true;

_root.myContainer.myText.embeddedCharacters = "ęąłńśźćóĘĄŁŃŚĆŻÓ";
myContainer.myText.htmlText = "test characters : : ęąłńśźćóĘĄŁŃŚĆŻÓ" ;

myContainer.myText.selectable = false;
myContainer.myText.wordWrap = true;
myContainer.myText.embedFonts = true;
myContainer.myText.setTextFormat(myFormat) ;

--
I was also trying with the following :

myContainer.myText.useDeviceFonts = true;

But without problem (otherwise I wouldn't email here, huh?)

Can someone tell me what i'm doing wrong that my embeddedCharacters don't seem to work?

Thanks in advance!
Greetz,
Dzjoepke

How Do You Define Which Character Set Gets Embedded With A Font Embedded In The Library (i.e. Korean)?
I have project that uses a shared fonts. The fonts are all contained in a single swf ("fonts.swf"), are embedded in that swf's library and are set to export for actionscript and runtime sharing.

The text in the project is dynamic and is loaded in from external XML files. The text is formatted via styles contained in a CSS object.

This project needs to be localized into 20 or so different languages.

Everything works great with one exception: I can’t figure out how to set which character set gets exported for runtime sharing. i.e. I want to create a fonts.swf that contains Korean characters, change the XML based text to Korean and have the text display correctly.

I’ve tried changing the language of my OS (WinXP) and re-exporting but that doesn’t work correctly. I’ve also tried adding substitute font keys to the registry (at: HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionFontSubstitutes) as outlined here:
http://www.quasimondo.com/archives/000211.php
but the fonts I added did not show up in Flash's font menue.

I’ve also tried the method outlined here:
http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_16275
to no avail.

I know there must be a simple solution that will allow me to embed language specific character sets for the fonts embedded in the library but I have yet to discover what it is.

Any insight would be greatly appreciated.

http://www.quasimondo.com/archives/000211.php

http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_16275

Difference Embedded And Not Embedded Font
Hi all,
I was wondering if anyone had the same problem I did.. I'm using a font called DS-Digital (free font) in one of my movies and well if I don't embed the font and use the textFormatter to determine my dynamic text width then everything is find, however if I use the embed font feature and determine it's with the same way then it's about 5-10 pixels smaller, which causes the text to display incorrectly..

Is there a way to fix it easily. Right now I just add 25 pixels to the textFormatter width just to be sure the font is displayed properly, but I hope there will be a different solution for this problem..

Thanks for any help..

Embedded Video + Embedded Cuepoints
I am using embedded video with embedded cuepoints.

When i put setBufferTime on 0 the cuepoints of the flvmovie will be readed good, the right moment.

If i put setBufferTime on 10 or 20 than the cuepoints will be readed 10 or 20 secs faster.

Somebody known of this problem?
And have a workaround for this?

I am using Netstream connection.
(not the flvPlayback or mediaPlayback component)

Embedded Fonts Vs Non Embedded
I am in the process of learning flash inside and out. During the testing phase of my design site I noticed that some of the text appeared very thin and hardly legible while other text was bold and vibrant. I checked the settings of the fonts to see if it was a Bold character setting issue but the fonts that were vibrant and thick had no Bold character setting at all. After many hours of comparing the different text boxes on the screen I realized that some of the text box had the embed font option on. This makes text less vibrant. Atleast it did with the particular font I used. Is it possible to cut down on memory while embedding the fonts and still have vibrant looking text? Try making several white text boxes on a black background with some of them being embedded and others not and you will see what I mean.

Best Regards,
Sam

P.S. THIS FREAKIN SITE ROCKS!

Why Do Embedded Fonts Blur When Non-embedded Fonts Dont?
If someone could offer a suggestion here I'd be much obliged. I'm trying to build a web site using pixel fonts but since very few people have this particular font, I'm trying to embed the font. The problem is that when I don't embed it looks perfectly sharp, but as soon as I embed it blurs them (as if it tries to anti-alias a pixel font.. which I don't want it to do)... any ideas?

Copyright © 2005-08 www.BigResource.com, All rights reserved