I' m making a game which have 2 levels, 3 scenes. After the last scenes, it will go back to the beginning at the first scenes. The problem is in the last scene, I made a loop of MCs which are targets to shoot with this code:
for(i=1;i<=numTarget;i++){
tar=_root.attachMovie("mcTarget","t"+i,i);
tar._x=random(Stage.width);
tar._y=-random(Stage.height);
tar._xscale=random(50)+50;
tar._yscale=tar._xscale;
tar.onEnterFrame=targetRun;
}
function targetRun(){
this._y+=spdTarget*(this._xscale/100);
if(this._y>Stage.height){
this._x=random(Stage.width);
this._y=-this._height;
}
I found they come back again and again in that very first scene until I go to the second scene. I tried so many code and put them in so many place for all day now. What I want is to remove them after the time is up which I use the Interval code.
What I've tried, for example:
tar=delete _root.attachMovie("mcTarget","t"+i,i);
mcTarget.swapDepths(_root.getNextHighestDepth(0));
mcTarget.removeMovieClip();
or change a number of amount
numTarget=0;
or create a fake scene, before the real first scene. Also this code,
_root.tar.swapDepths(_root.getNextHighestDepth());
_root.tar.removeMovieClip();
or
mcTarget._visible=false;
_root.tar._visible=false;
tar._visible=false;
What can I do any more?