i have already imported the images externally. but i would like to put them in the BitmapData which needs to specify the width and height. i dont want to hard code it, i want to get the width and height of the image itself and then assign to the width and the height of the Bitmapdata.
i can't seem to find any way to do that. pls help.
var loader:Loader = new Loader();
var bmd:BitmapData;
var bitmap:Bitmap;
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded);
loader.load(new URLRequest("yourfile.jpg"));
function imageLoaded(event:Event):void{//event.target is loader.contentLoaderInfo, and already//has the information as to the width and height of//the loaded image:
bmd = new BitmapData(event.target.width, event.target.height);
bmd.draw(loader);
bitmap = new Bitmap(bmd);
addChild(bitmap);
//alternatively, since event.target.content is a bitmap object,//try uncommenting this code and commenting the previous block:/*bitmap = event.target.content;
addChild(bitmap);*/}