I’m trying to make a button that when u click once, the movieclip will be removed and second time back on stage and so forth…
somehow i get this error
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display:DisplayObjectContainer/removeChild()
at sample_fla::MainTimeline/btnClick()
==================================
Anyone can help me with this, since I’m doing an interactive web for client and the deadline is near… thanks in advance.
these are my code:
///////////////////////////////////////////////////
stop();
var swf:MovieClip;
var loader:Loader= new Loader();
var defaultswf:URLRequest= new URLRequest("./newSwfImport.swf");
//default swf when loaded
loader.load(defaultswf);
//add to stage
allSwfLoadHere.addChild(loader);
var boolean:Boolean = true ;
function btnClick(event:MouseEvent):void {
if(boolean == true){
allSwfLoadHere.removeChild(loader);
boolean == false
}
if(boolean ==false){
allSwfLoadHere.addChild(loader);
boolean == true
}
}
newSwfImport.addEventListener(MouseEvent.CLICK,btnClick);
//////////////////////////////////////////////////////