When loading images using Loader, what's the preferred way to add the image to the display list? Grabbing the data in an Event.COMPLETE handler like new Bitmap( Bitmap(LoaderInfo( ) , or adding the Loader instance itself?

Was it helpful?


If you only want to display the Loader's content, then feel free to add the Loader to the display list rather than extracting its contents. It's an uncommon situation when you'll need to reparent a Loader's content.

Additionally, it's worth noting that a Loader's content will not always be accessible. For instance, Flash Player places security restrictions on content loaded from other domains. When these stronger security rules are enforced, Flash Player throws security errors at runtime if you try to access the Loader's content.


It is better to wait for the Loader to complete and set the Image data in the result handler.

You cannot add Children to Loader class because ..... quote from livedocs"The Loader class overrides the following methods that it inherits, because a Loader object can only have one child display object"

Bitmap supports image smoothing when resizing and that's handy sometimes. On the other hand, Loader is DisplayObjectContainer and allows adding other children inside.

Loader is handy as it makes data handling quite neat (loading/unloading). Personally I'd need to have a good reason to extract data from a loader object.

In the case of an image a good reason would be that whatever your doing with the data requires the BitmapData class.

If you are simply displaying the image then you wont necessarily need the BitmapData class. In this case working with BitmapData is alota code ya dont need!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top