I need help figuring out why I cannot convert a loaded jpeg to a bitmap.
I’ve found similar posts on this forum but the solutions provided are not working for me. I have a very simple example of what I’m trying to do below:
private function loadImage():void
{
var imageLoader:Loader = new Loader();
imageLoader.name = "imageLoader";
container_mc.imageHolder_mc.insideTop_mc.loadedImage_mc.addChild(imageLoader);
var req:URLRequest= new URLRequest("images/busi_woman.jpg");
imageLoader.load(req);
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadedImage);
}
/**
*
*
*/
private function loadedImage(e:Event):void
{
trace("LOADED");
var loadedImage:Bitmap = Bitmap(e.target.content);
var dupedImage:Bitmap = new Bitmap(loadedImage.bitmapData);
container_mc.imageHolder_mc.insideTop_mc.loadedImage_mc.getChildByName("imageLoader").contentLoaderInfo.removeEventListener(Event.COMPLETE, loadedImage);
TweenLite.to(e.target.content, .5, {alpha:1, ease:Expo.easeOut});
}
For whatever reason I get the error:
TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::Bitmap@3a0926d1 to Function.
at com.ncnmar.interphaz::People01/loadedImage()
Could someone shed some light on this for me?