Re: [Flashcoders] help removing an display object created

2009-06-04 Thread Gustavo Duenas
Hi Glen, problem is that for each button it creates a different clip  
named newWindow.


I have them named and it works according to your last formula the  
name of each one is root1 + the name on the object
I 'm trying to make a code to see first which is the object that is  
already created like


function removeClip():void{

if (root1.displayObject.name =="contact"){
removeChild(root1.contact);
}else if(root1.displayObject.name=="aboutUs"){
removeChild(root1.aboutUs);
}else if(root1.displayObject.name=="support"){
removeChild(root1.support);
}else if(root1.displayObject.name=="process"){
removeChild(root1.process);
}else if(root1.displayObject.name =="enviroment"){
removeChild(root1.enviroment);
} else{ trace("everything clear");
}

That is exactly the structure of what I'm looking for.

Regards,

Gustavo

P.s: this is a wild guess I haven't tried yet.

On Jun 4, 2009, at 4:16 AM, Glen Pike wrote:


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
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders






___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] help removing an display object created

2009-06-04 Thread Glen Pike

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
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] help removing an display object created

2009-06-03 Thread Gustavo Duenas



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
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders