PDA

View Full Version : removeMovieClip removing the wrong movie!!?!?!


Doddy22
11-10-2002, 12:44 AM
Hi,

I was writing a small platform game when I stumbled into a problem, at a certain point the entire background would dissappear, and after a couple of hours of debugging found that was my removetiles function which was the cause.

removeTile = function(whichTile){
var tiletype = tilegrid[whichTile]
if(tiletype != undefined){
if(tiletype<foreground_tiles_start_at){
background["Tile"+whichTile].removeMovieClip();
}else{
foreground["Tile"+whichTile].removeMovieClip();
}
}
}

this function works perfectly, except when it called removeTile(726)

when that was called tiletype == 5, so it should have gone on to delete background.tile726 but instead it deleted background.

i place a small loop before background ["Tile"+whichTile].removeMovieClip() that output the name of all the clips in background and tile726 was in that.
i also placed a trace(background._target) before and after that line and which confirm that it was that line that is the problem, background._target was undefined after the removeMovieClip was called.

Is this a bug or have i just done something wrong?