Hi All,

This is my first post here.
I am struggling with an issue where i have 2 buttons which i want to use with a getTimer function.


If i multiple (repeatedly) click the buttons - i want to remain on the same frame until 5 seconds after the last click.

But If i do not click (no activity) on either button for more than 5 seconds i want it to go and visit a new frame - _root.gotoAndPlay(50);


Should i bet trying to reset the getTimer in the 'if' statement so i can multiple click before ‘else’ statement activates?
Or should i be using a Listener to detect if the button has been clicked?
Or is it better to use setInterval and clear Interval instead of getTimer?

I would be very grateful for any help on this one.
Code below:



var startTime:Number = getTimer();
this.onEnterFrame = function() {
var difference:Number = (getTimer() - startTime) / 1000;

if (difference < 5) {
buttonLeft.onRelease = function() {
flowAnimation.prevFrame();
}
buttonRight.onRelease = function() {
flowAnimation.nextFrame();
}
}

else {
_root.gotoAndPlay(50);
delete onEnterFrame;
}
};