PDA

View Full Version : undo attachmovie function?


Timon
01-19-2006, 11:35 AM
Hey, I got this code to duplicate a movieclip and display the duplicated movieclips in a circle:


//define the centre of your circle
var oX:Number = 160;
var oY:Number = 245;
//define the radius
var rad:Number = 145;
//the number of buttons
var buttons:Number = 5;
//work out how big the angle is between each button:
var delta:Number = 2*Math.PI/(buttons);
//assuming you are attaching your buttons to this:
for (var i = 0; i<buttons; i++) {
_root.attachMovie("test", "button"+i, i, {_x:oX+Math.cos(i*delta)*rad, _y:oY+Math.sin(i*delta)*rad});}


It works fine, but if I wanna go to an other frame the circle remains visible, no mather where I go even if i go to an other movieclip. How can you 'undo' or delete this circle?

Thanx

yker22
01-19-2006, 11:04 PM
use yourmovie_mc.removeMovieClip() method...

sophistikat
01-19-2006, 11:27 PM
// if you want to delete all
for (var i = 0; i<buttons; i++) {
this["button"+i].removeMovieClip();
}

// if you want to delete one or two
button0.removeMovieClip();
button3.removeMovieClip();