# MX beginner question = break my if loop?

**URL:** <https://forum.kirupa.com/t/mx-beginner-question-break-my-if-loop/218932>\
**Category:** Uncategorized\
**Created:** [March 12, 2007, 3:41pm UTC](https://forum.kirupa.com/t/mx-beginner-question-break-my-if-loop/218932 "2007-03-12T15:41:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Martie](https://avatars.discourse-cdn.com/v4/letter/m/7c8e57/32.png) [@Martie](https://forum.kirupa.com/u/Martie)\
**Post date:** [March 12, 2007, 3:41pm UTC](https://forum.kirupa.com/t/mx-beginner-question-break-my-if-loop/218932/1 "2007-03-12T15:41:49Z")

</div>

I have a timer that seems to work for me in one scene and is suppose to send the action to the next scene, but the “if” loop is still looping when the action is in the next scene. The “stops” I put in don’t seem to stop anything. I am a beginner who needs help, thanks.

//wait 5 seconds  
onEnterFrame = function () {  
if (timed) {  
elapsedTime = getTimer()-startTime; //startTime was picked up in previous frame  
elapsedSec = Math.floor(elapsedTime/1000);  
if (elapsedSec\<5) {  
trace(elapsedSec); //this works  
} else {  
timed = false;  
}  
} else {  
stop();  
trace(“I am here”); ///this trace keeps going and going through the next scene  
gotoAndPlay(“Scene 4”, 1);  
}  
};  
stop();
