smdevivo
asked on
Problems getting the getTimer function to work properly
Hello:
I am looping between 2 frames using getTimer in conjunction with gotoAndPlay - see attached code.
Basically, the timeline travels to Frame 20, pauses for 2 seconds, then goes back to Frame 1 and plays again. And that process repeats over and over again unless the user hits a Continue button on the stage to then move to another area of the timeline. That part is working perfectly.
The problem occurs if the next loop takes longer than 2 seconds. In other words instead of going from Frame 1 to 20, the next sequence might go from Frame 21 to 100. Before it makes it to Frame 100 the previous getTimer process takes control and sends me all the way back to Frame 1.
In my limited experience with Flash AS2, it appears as though the previous timer is still running and each time it clicks off 2 seconds, it performs the previous gotoAndPlay (1). In other areas of the timeline, where the the Point A to B is quick within the timeline, this problem never occurs.
Hope I explained that all clearly. Any help would be greatly appreciated.
Steve
I am looping between 2 frames using getTimer in conjunction with gotoAndPlay - see attached code.
Basically, the timeline travels to Frame 20, pauses for 2 seconds, then goes back to Frame 1 and plays again. And that process repeats over and over again unless the user hits a Continue button on the stage to then move to another area of the timeline. That part is working perfectly.
The problem occurs if the next loop takes longer than 2 seconds. In other words instead of going from Frame 1 to 20, the next sequence might go from Frame 21 to 100. Before it makes it to Frame 100 the previous getTimer process takes control and sends me all the way back to Frame 1.
In my limited experience with Flash AS2, it appears as though the previous timer is still running and each time it clicks off 2 seconds, it performs the previous gotoAndPlay (1). In other areas of the timeline, where the the Point A to B is quick within the timeline, this problem never occurs.
Hope I explained that all clearly. Any help would be greatly appreciated.
Steve
stop();
timeDelay = getTimer()+2000;
onEnterFrame = function(){
if (this.timeDelay <= getTimer()){
gotoAndPlay(1);
delete onEnterFrame;
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER