1 Reply Latest reply on Sep 27, 2006 11:06 AM by crazyjoemilan

    Timing Control of buttons

      I'm trying to contol the actions for a button. Keying a button 5 times in 5seconds will activate something to turn on. How can this be done if at all possible?
        • 1. Re: Timing Control of buttons
          crazyjoemilan Level 2
          of course its possible, this is flash!

          You'll want your button to set a counter- something like this...

          on(release) {
          if (counter == null) {
          counter = 1
          //then you'll want to start some kind of timer. this would be more efficient in its own function, but this is what I would do off the top of my noodle.
          startTimer = getTimer();
          else {
          if (counter >= 5) {
          finalTimer = getTimer();
          difference = finalTimer - startTimer
          if (difference >= 5000) {
          trace("sorry dude");
          //or whatever action
          counter = null
          else {
          trace("you win!")
          //or whatever action

          I think that would work, try it.