Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

removeMovieClip problem

Status
Not open for further replies.

quaker93

Technical User
Jun 28, 2006
9
0
0
US

I have a scene where I am creating instance of a movie clip using duplicateMovieClip adding more and more on each successive frame up to 10. I have the following actionScript code in each frame 1-10:

var ln:Number;
var duplicate:MovieClip;
var i:Number;
var newY:Number;
var newX:Number;
var rot:Number;
var starter:Number;
ln = 10*_currentFrame;
starter = (_currentFrame-1)*ln+1;
for(i = starter; i < (ln+starter); i++) {
newY = _level0.beachy._x - Math.random()*(_currentFrame/10*_level0.beachy._height*1.2);
newX = _level0.beachy._y + Math.random()*_currentFrame/10*_level0.beachy._width;
rot = 60*(Math.random()-.5);
duplicate = this.attachMovie("star",'clip-' + i, i, {_y:newY, _x:newX, _rotation:rot});
trace(_currentFrame + " " + starter);
trace(duplicate); // _level0.clip-[number]
}

At frame 11 I would like to use removeMovieClip to get rid of them in the same order they were created. Currently I have this at each frame 11-20:

var ln:Number;
var i:Number;
var newY:Number;
var newX:Number;
var rot:Number;
var starter:Number;
var newFrame:Number;
newFrame = _currentFrame-10;
ln = 10*newFrame;
starter = (newFrame-1)*ln+1;

for(i = starter; i < (ln+starter); i++) {
removeMovieClip("clip"+i);
}


I have tried just about every syntax of removeMovieClip that I could find on the forums and nothing seems to work. I can't figure out what I'm doing wrong.
Any suggestions?

Thanks
Tim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top