Hello community:
This code works. It puts my external image on the stage:
var pngurl:URLRequest=new URLRequest("image.png");
var pngloader:Loader=new Loader();
pngloader.load(pngurl);
this.addChild(pngloader);
This code works to, but not completely. It stores the same image inside of a movie clip that I’ve named “panel”. However, the image is **bigger **than “panel”:
var pngurl:URLRequest=new URLRequest("image.png");
var pngloader:Loader=new Loader();
pngloader.load(pngurl);
panel.addChild(pngloader); //panel is the name of my movieclip
I almost fixed my problem by changing my code. My image is** smaller** than “panel” now, but its width and height should be the same as “panel”:
var pngloader:Loader=new Loader();
pngloader.load(new URLRequest("image.png"));
pngloader.contentLoaderInfo.addEventListener(Event.COMPLETE, makeThumbs);
function makeThumbs(evt:Event):void {
var tw:Number=panel.width;
var th:Number=panel.height;
var tbit:BitmapData=new BitmapData(tw,th);
tbit.draw(evt.target.content);
var thumb:Bitmap=new Bitmap(tbit);
panel.addChild(thumb);
}
Does some one have experience with this. I’d appreciate any tips. (Original image size= 350width and 250height) (Panel size=100width and 100height)