all groups > flash actionscript > september 2006 >
You're in the

flash actionscript

group:

Timing Control of buttons



Timing Control of buttons TuulaRedditt
9/27/2006 4:46:53 PM
flash actionscript:
Re: Timing Control of buttons Mr Helpy mcHelpson
9/27/2006 6:06:51 PM
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 {
counter++
}
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.
AddThis Social Bookmark Button