Ross
Ross

Reputation: 11

bitmap data as movie clip

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

Upvotes: 0

Views: 833

Answers (2)

jonathanasdf
jonathanasdf

Reputation: 2894

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?

Upvotes: 0

Josh Knauer
Josh Knauer

Reputation: 1754

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

addChild(imageLoader);

Upvotes: 1

Related Questions