<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
width="400" height="300"
applicationComplete="createApp();">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
private var timer:Timer;
private function createApp():void
{
timer = new Timer(1000, 10);
timer.start();
timer.addEventListener(TimerEvent.TIMER, timerHandler);
timer.addEventListener(TimerEvent.TIMER_COMPLETE, timerCompleteHandler);
}
private var i:int = 10;
private function timerHandler(event:TimerEvent):void
{
i--;
lbl.text = i.toString();
if (i == 0)
timer.stop();
}
private function timerCompleteHandler(event:TimerEvent):void
{
Alert.show("Countdown Complete");
}
]]>
</mx:Script>
<mx:VBox width="100%" height="100%" horizontalAlign="center" verticalAlign="middle">
<mx:Label id="lbl" text="10" fontSize="18"/>
</mx:VBox>
</mx:Application>
댓글 없음:
댓글 쓰기