Loader issue


Last friday I was checking Flash Bookmarks and I noticed a question about Loader.
While ago I needed to load a file using a Loader and then add it to the stage. However it raised an error.

ArgumentError: Error #2025 : The supplied DisplayObject must be a child of the caller.


To solve the problem I needed to extract the conten in a var and then call a loader.unload() before add it to the stage.

function onLoadComplete(e:Event):void{
	var image:Bitmap = e.currentTarget.content;
	loader.unload();
	addChild(image);
}


It’s the same case when you try to load two or more files using the same loader.


Example

Tags: ,

Leave a Reply