Hi,
Sorry, I just replied to your other thread, but now I see your code...
Try something like this...
function removeClip(thenameoftheobject) {
thenameoftheobject.parent.removeChild(thenameoftheobject);
}
Glen
Gustavo Duenas wrote:
I have several buttons which create some windows based on a movie clip
that exports for actioncript.
Everything is ok, with the creation, but when it comes to close them (
I have a button in the window itself that
can remove the child), I will trying to do it using actionscript.
if (stage.contains(thenameoftheobject)){
stage.removeChild(thenameoftheobject)}
but so far it isn't working,
Flash is telling me that the display object is not there (course is
not there until it is created by the button) so everyone knows how
could I
remove the child from the same buttons without the warning that the
buttons are not there.
here is my code for the windows. it will explain how I have those
created.
function newClick(e:MouseEvent){
productsOff();
removerChild()
gotoAndPlay(75);
var newBack:Loader = new Loader();
newBack.load(new URLRequest("imgs/sombrero.jpg"));
this.backMovie.addChild(newBack)
var myWindow:AboutUsWindow = new AboutUsWindow();
myWindow.name = e.currentTarget.name;
trace(myWindow.name);
myWindow.x=500.0;
myWindow.y=391.0;
var myText:URLLoader= new URLLoader();
myText.addEventListener(Event.COMPLETE, onLoaded);
function onLoaded(e:Event):void{
myWindow.textoWindow.text= e.target.data;
myScroll.scrollTarget=myWindow.textoWindow;
}
myText.load(new URLRequest("text/"+ e.currentTarget.name+".txt"));
var myScroll:UIScrollBar = new UIScrollBar();
myScroll.enabled=true;
myScroll.direction= "VERTICAL";
myScroll.setSize(myWindow.textoWindow.width,
myWindow.textoWindow.height);
myScroll.x=300;
myScroll.y=-33;
myScroll.height = myWindow.textoWindow.height;
myWindow.addChild(myScroll);
var myLoader:Loader = new Loader();
myLoader.load(new URLRequest(e.currentTarget.name+".swf"));
myWindow.imgScreen.addChild(myLoader);
myWindow.botoncito.buttonMode=true;
myWindow.botoncito.addEventListener(MouseEvent.MOUSE_OVER,
botoncitoOver);
myWindow.botoncito.addEventListener(MouseEvent.MOUSE_OUT,
botoncitoOut);
myWindow.botoncito.addEventListener(MouseEvent.CLICK,
botoncitoClick);
//new botoncitoBehaviour//
function botoncitoOver(e:MouseEvent):void{
e.currentTarget.gotoAndPlay(2);
}
function botoncitoOut(e:MouseEvent):void{
e.currentTarget.gotoAndStop(1);
}
function botoncitoClick(e:MouseEvent):void{
removeChild(e.currentTarget.parent);
}
addChild(myWindow);
}
Any help is appreciated.
Gus
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders