Skip to main content
vigneshvicky
Known Participant
January 18, 2016
Pregunta

.if i add a movieclip like below code means then how can i remove the movieclip from stage .....

  • January 18, 2016
  • 1 respuesta
  • 474 visualizaciones

.if i add a movieclip like below code means then how can i remove the movieclip from stage .....

function dupCircle(){

     var circ = new myCircle();

     circ.x = Math.random () *400;    

      circ.y = Math.random () *250;

     addChild(circ);

}

Este tema ha sido cerrado para respuestas.

1 respuesta

kglad
Community Expert
Community Expert
January 18, 2016

among the ways to remove from same timeline that contains that code:

  var circ:myCircle;

function dupCircle(){

    circ= new myCircle();

     circ.x = Math.random () *400;    

      circ.y = Math.random () *250;

     addChild(circ);

}


function removeCircF():void{

removeChild(circ);

}

however, if it's possible to call dupCircle twice (or more) without calling removeCircF, that won't work and you'll need to do something else. eg,

var circA:Array=[];

function dupCircle(){

     var circ = new myCircle();

     circ.x = Math.random () *400;    

      circ.y = Math.random () *250;

     addChild(circ);

circA.push(circ);

}


function removeAllCircF():void{

for(var i:int=circA.length-1;i>=0;i==){

removeChild(circA);

circA.splice(i,1);

}

}

vigneshvicky
Known Participant
January 19, 2016

thnks bro............

kglad
Community Expert
Community Expert
January 19, 2016

you're welcome.

(p.s when using the adobe forums, please mark helpful/correct responses, if there are any.)