views:

24

answers:

2

Hi,

I import my images with

imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete); imageLoader.load(imageRequest);

and then try and cast as a movieclip:

var newImage:MovieClip = imageLoader.content as MovieClip; addChild(newImage);

i keep getting errors, is this possible?

Thanks,

Ross

+1  A: 

Don't cast it as a MovieClip. Just add the loader to the stage, like this:

addChild(imageLoader);
Josh Knauer
A: 

you can only do that when the loader has completed loading.

so if that bit of code is in the onComplete function, and you're doing var newImage:MovieClip = e.content as MovieClip;, that should work.

What specific errors are you getting?

jonathanasdf