Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import flash.text.TextField;
- import flash.utils.Timer;
- import flash.events.TimerEvent;
- var count:uint = 5
- var counter:TextField = new TextField ();
- counter.text = "Count Down: " + count;
- counter.x=50
- counter.y=120
- counter.scaleX = 5
- counter.scaleY = 5
- counter.width = 500
- addChild(counter);
- var myTimer:Timer = new Timer(1000);
- myTimer.addEventListener(TimerEvent.TIMER, countDown);
- myTimer.start();
- function countDown(event:TimerEvent) {
- if(count > 0) {
- count = count -1;
- counter.text = "Count Down: " + count;
- }else {
- counter.text = "Game Over";
- myTimer.stop();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement