I have created an image gallery that has company logos loaded into a movieclip at the bottom and scrolls based on the user’s mouse location. When the user clicks on one of the logos it should load the corresponding screenshot. The function for loading the screenshot is this:
function clickScrollerItem(me:MouseEvent):void {
var imageLoader:Loader = new Loader();
//removeChild(imageLoader);
imageLoader.load(new URLRequest(me.currentTarget.src));
fullImage.x = 10;
fullImage.y = 20;
fullImage.addChild(imageLoader);
fadeTween = new Tween(imageLoader, "alpha", None.easeNone, 0, 1, 1, true);
}
The screenshots are of varying size, so I want to remove the one that’s currently displayed before loading the new one. When I do a
removeChild(imageLoader);
I get an error:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
Can anyone tell me what I’m doing wrong here?