stupid error #2025 - How can I solve it?
Hi! How Are you guys! I'm having a problem while I'm trying to remove a Child. I have a button that loads the loader and a next and back button that let you navigate through the images in it. And last the MENU button that brings into the stage the menu bar. I would like that when you click the menu an action to remove the images from the loader. I can do that, but only if there were some images there in the loader, otherwise I get this error:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller. at flash.display:
:DisplayObjectContainer/removeChild()
It seems that the IF STATEMENT doesn't work properly. I guess that it must have an error, but I can't figure it out which.
Thanks in advance!!
Here is my code:
menuBra.addEventListener (MouseEvent.CLICK, onClickBra);
function onClickBra (event:MouseEvent):void {
if(contains(loaderBrand)) {
removeChild(loaderBrand);
var TweenPrint1:Tween = new Tween(menu_mc,"x", Strong.easeOut, -4000, 0, 1, true);
}
else {
var TweenPrint2:Tween = new Tween(menu_mc,"x", Strong.easeOut, -4000, 0, 1, true);
}
trace ("menu was clicked"); }