How do I get the Interval to keep from repeating after it's used once? Because I tried clearInterval but I couldn't get it working.
When my code looks like this, with ClearInterval, it refuses to execute my action, which is to change scenes after a short interval:
(Pardon if there is some formating errors, I had to reformat it for the Internet)
| Code with clearInterval command |
|---|
stop();
Kollektiv.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_2);
function fl_ClickToGoToAndPlayFromFrame_2(event:MouseEvent😞void{
gotoAndPlay(29); var myInterval:uint = setInterval(fl_ClickToGoToNextScene_14,3000); clearInterval(myInterval); }
function fl_ClickToGoToScene_14(event:MouseEvent😞void{ MovieClip(this.root).gotoAndPlay(1, "Testside"); }
|
However, when my code looks like this it refuses to stop looping:
| Code without ClearInterval command |
|---|
stop();
Kollektiv.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_2);
function fl_ClickToGoToAndPlayFromFrame_2(event:MouseEvent😞void{
gotoAndPlay(29); setInterval(fl_ClickToGoToNextScene_14,3000);
} function fl_ClickToGoToScene_14(event:MouseEvent😞void{ MovieClip(this.root).gotoAndPlay(1, "Testside"); }
|
Any ideas? Also, feel free to dumb your answer down, because I am completely new to Flash, Actionscript and coding.