A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: AS2 - If no button click for 5 seconds - go to new frame

  1. #1
    Junior Member
    Join Date
    Jul 2016

    AS2 - If no button click for 5 seconds - go to new frame

    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() {
    buttonRight.onRelease = function() {

    else {
    delete onEnterFrame;

  2. #2
    . fruitbeard's Avatar
    Join Date
    Oct 2011

    Answered in the section above

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

HTML5 Development Center