I have been looking for Loader's Class information to understand an example but I'm stuck on something. Here is the code:
var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loading Complete); var requestLink:URLRequest = new URLRequest(bitmap01); loader.load(requestLink);
private function loadingComplete(event:Event):void{ var image:Bitmap = Bitmap(event.target.loader.content); ... }
So here's my problem:
event.target.loader makes reference to the Loader Object. So event.target.loader.content makes reference to the "the root display object of the SWF file or image (JPG, PNG, or GIF) file that was loaded by using the load() or loadBytes() methods." (according to Flash Help).
Here we are using this "content" to create a new Bitmap Object. But the first parameter of the Bitmap's constructor must be a bitmapData Object.
So what I need to clear up is what the property content makes reference to? Is it the image itself or the bitmapData property if the image is a Bitmap type or something else?
If I'm not mistaken, when you load an image, Loader.content is the BitmapData of the image. When you load a swf, Loader.content is the base/root display object that swf was created from. Like the Document class of that swf. Hope this helps.