1 Attachment(s)
I can't stop for loop mc and I don't know why my mc always be at the top left corner.
Hi all,
I really in a frustrated mood. I tried to figure it out all day long to finished my game. I'm making a game which has 2 levels; 3 scenes. And I ran into 2 problems. First, I can't stop my MCs which I attach to make them looping with this code
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:
Code:
tar=delete _root.attachMovie("mcTarget","t"+i,i);
mcTarget.swapDepths(_root.getNextHighestDepth(0));
mcTarget.removeMovieClip();
_root.tar.swapDepths(_root.getNextHighestDepth());
_root.tar.removeMovieClip();
mcTarget._visible=false;
_root.tar._visible=false;
tar._visible=false;
I also creat a function to remove it like this:
Code:
rePlaytxt = 365;
rePlay = function(){
rePlaytxt--;
if(rePlaytxt==0){
clearInterval(countBack);
this.onEnterFrame=removeTarget;
gotoAndPlay("intro",2);
}
}
countBack = setInterval(rePlay,50);
function removeTargets():Void{
for(i=1;i<=numTarget;i++){
delete this["t"+i].onEnterFrame;
this["t"+i].removeClip();
}
}
still...didn't work! I tries even make a fake scene before the real first scene. :P But nothing.
What can I do any more? Where am I missing? or Where should I put the code on?-- I put it right in the Interval code.
----------------------------------------
And another issue...
Have anyone ever got thing like this: when use removeMovieClip(); and however you tried these MCs( which is a bullet in my game and another is that looping mc) will just appear at the top left corner. How can you get rid of it???
Attachment 74053
Thank you so much if you guys can tell me or just answer on one of the two.
(T-T")
Pleaseee HELP!