Thursday 15 January 2015

Timer class - delay before executing function again? -


I have found an issue which can be solved very easy, I think .. but my art is not with the brain . Google offers me a timer class, however, not the examples of what I need. Just this is a vote counter - you can press the five buttons, some of them will change the counter first, second - the second counter. The function can be called again before that what I want to do now (such as 3000 ms) is to be delayed (say 3000 ms), so if all the buttons start to break fast, then the results are not bad Thanks for the help

  var number: uint = 0; Var Count 2: UIT = 0; Counter1.text = '0'; Counter2.text = '0'; Step. AddEventListener (KeyboardEvent.KEY_UP, saved) step. AddEventListener (KeyboardEvent.KEY_UP, Stuck) function saved (Event: KeyboardEvent): Zero {if (event.keyCode ==49) Calculation ++; Counter1.text = count.toString (); If (event.keyCode == 109) count ++; Counter1.text = count.toString (); } Function trapped (event: keyboard accent): zero {if (event.keyCode == 54) count2 ++; Counter2.text = count2.toString (); If (event.keyCode == 36) count2 ++; Counter2.text = count2.toString (); If (event.keyCode == 18 9) count2 ++; Counter2.text = count2.toString (); Suppose you can use sleep (), say that you are using C ++, enter the function and the number of milliseconds required in it.   

No comments:

Post a Comment