What keeps my movie from stopping properly? Math.floor/interval

Hey all,

this is driving me nuts.
I have a movie, in it lies a button with which I jump to another position in the _root timeline.
At that position is a stop(); command.

The movie just wont stop while this is running in another mc1 deeper in the file
:

stop();
onEnterFrame = function() {
	
c=Math.floor(Math.random() * (1500 - 0)) + 150;

var Interval1 = setInterval(function () {
b=Math.floor(Math.random() * (7 - 0)) + 1;
gotoAndPlay(b);
clearInterval(Interval1);
}, c);
}

What this does in the mc1 is basically creating a random number between 150 and 1500 and a random number between 0 and 7, then jumping to a random frame (numbered from 1-7) after waiting for a random time (150-1500ms).

My _root stops properly when I remove the code posted above.
Why is this happening and how can I have a mc1 in my movie which waits for a random time and then jumps to a random frame, while I want to move around in my _root timeline?
I should add, the mcs1 which wait and move to a random frame are non existent on the position I want to move to in _root.

Could that be part of the problem?
Do I have to somehow remove the wait and choose random frame to jump to function in mc1, when moving around in _root? :crying:

How would i do this?

Any help is greatly appreciated,
dual

If your frame rate is more than 6 fps (which I’m sure it is) then the onEnterFrame function is always triggered in less the 150ms, meaning the interval is reset before the interval is ever completed.