Skip to main content
Known Participant
October 25, 2010
Answered

Trye Everything, please help with stop();

  • October 25, 2010
  • 1 reply
  • 477 views

ok i have a movieclip on scene 2, which plays an animation, waits a random time then plays again.

the code i used is making stop(); not work.

frame 1 inside the movie clip:

function paause(){
play();
clearInterval(timer);}

frame 40:

stop();

howlong = Math.random()* 7500+4000;
timer = setInterval(paause, howlong);

On scene 3 i have 1 frame with the code stop(); on it. it doesnt work. It seems to act on the movie clips code. WHy ive been trying to solve this for about 4 hours please some 1.

This topic has been closed for replies.
Correct answer Ned Murphy

You should look things up in the Flash help documentation if you want to see how they work.

In your case, try the following: remove the code you showed from frame 1 inside the movieclip and place all of the following in frame 40...

stop();

function paause(){

    play();

}

var howlong = Math.random()* 7500+4000;
var timer = setTimeout(paause, howlong);

1 reply

Ned Murphy
Legend
October 25, 2010

Do you have a stop(): in scene 2?  It might be failing due to trying to use a variable that is undefined in frame 1 (timer).  You could try using setTimeout instead.  That does not require the use of a clearing method.

unamus3dAuthor
Known Participant
October 25, 2010

Yes i have a stop at the end of scene 2.

id like to try set timeout but i dont know how :|

Its really bugging me now ive spent all day trying to fix it!

Ned Murphy
Ned MurphyCorrect answer
Legend
October 25, 2010

You should look things up in the Flash help documentation if you want to see how they work.

In your case, try the following: remove the code you showed from frame 1 inside the movieclip and place all of the following in frame 40...

stop();

function paause(){

    play();

}

var howlong = Math.random()* 7500+4000;
var timer = setTimeout(paause, howlong);