Copy link to clipboard
Copied
.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);
}
Copy link to clipboard
Copied
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);
}
}
Copy link to clipboard
Copied
thnks bro............
Copy link to clipboard
Copied
you're welcome.
(p.s when using the adobe forums, please mark helpful/correct responses, if there are any.)
Copy link to clipboard
Copied
K
Find more inspiration, events, and resources on the new Adobe Community
Explore Now