analogWatch.mxml====================================================================================
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="350" height="350" initialize="init()">
<mx:Style>
Application{
backgroundColor: #ffffff;
}
</mx:Style>
<mx:Script>
<![CDATA[
import flash.utils.*;
import flash.events.*;
private var hour:Number;
private var minute:Number;
private var second:Number;
private var millisecond:Number;
private function init():void
{
var myTimer:Timer = new Timer(1000, 0);
myTimer.addEventListener("timer", timerHandler);
myTimer.start();
}
private function timerHandler(e:TimerEvent):void
{
var now:Date = new Date();
hour = now.getHours();
minute = now.getMinutes();
second = now.getSeconds();
millisecond = now.getMilliseconds();
secondNeedle.rotation = (6*second + 0.006*millisecond) + 180;
minuteNeedle.rotation = (6*minute + 0.1*second) + 180;
hourNeedle.rotation = (30*hour + 0.5*minute) + 180;
if(hour > 12)
{
txtAmPm.text = "PM";
}
else{
txtAmPm.text = "AM";
}
}
]]>
</mx:Script>
<mx:Canvas x="0" y="0" width="100%" height="100%" backgroundImage="@Embed('images/BG.png')" id="cv1">
<mx:Image source="@Embed('images/hour.png')" x="172" y="175" id="hourNeedle"/>
<mx:Image source="@Embed('images/minute.png')" x="172" y="175" id="minuteNeedle"/>
<mx:Image source="@Embed('images/second.png')" x="174" y="175" id="secondNeedle"/>
<mx:Text x="81" y="132" fontSize="20" id="txtAmPm"/>
</mx:Canvas>
</mx:Application>
=====================================================================================================
'OM' 카테고리의 다른 글
영어 학습 컨텐츠 (0) | 2008.02.22 |
---|---|
keyUtil (0) | 2008.02.09 |
타자게임 (0) | 2008.02.09 |
달력을 이용한 다이어리 (0) | 2008.02.08 |
달력 (0) | 2008.02.07 |
D-day 구하기 2 (0) | 2008.02.07 |
D-day 구하기 1 (0) | 2008.02.05 |
디지털 시계 (0) | 2008.02.03 |
동영상 플레이어 (0) | 2008.01.11 |