I am trying to load .jpg dynamically from xml input. This is the first time I've attempted this with AS3, and I'm not sure why I'm getting the error I'm getting.
On my stage, I have a mc named imageHolder which I'm trying to load the .jpg into. I can see the var imageName being traced out properly, so I know I have the correct data. Here's the code snippet:
var imageName:String = xml.mpu.bodyText.page.imageUrl[event.currentTarget.ivar];
trace("imageName = " + imageName);
var myBitmap = imageName;
and here's the error I'm receiving:
TypeError: Error #1034: Type Coercion failed: cannot convert "1.jpg" to flash.display.DisplayObject.
can anyone shed some light on why I can't convert 1.jpg?
imageName is a string, not a bitmap or any other type of displayobject.
you would normally create a urlrequest instance from that string and load that urlrequest using a loader. loaders are display object and can be added to the displaylist.
Nice one, thanks for the tip kglad. After much studying and reading this weekend based off your reply, I got it
figured out this morning.
Cheers to you,