본문 바로가기

OM

D-day 구하기 1


Dday.mxml===========================================================================================

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="550" height="400" initialize="init()">
 
 <mx:Style>
  Application{
   backgroundColor : #ffffff;
   fontSize : 18;
  }
 </mx:Style>
 
 <mx:Script>
  <![CDATA[
     
   private function getDday(_yy:int, _mm:int, _dd:int):int
   {
    var Dday:Date = new Date(_yy, _mm-1, _dd);
    var now:Date = new Date();
    var diff:Number = Dday.getTime() - now.getTime();
   
    if(diff < 0)
    {
     txt2.text = "지났습니다.";
    }
    else{
     txt2.text = "남았습니다.";
    }
   
    return Math.abs(diff/1000/60/60/24);
   }
   
   private function init():void
   {
    txt1.text = getDday(2010, 6, 12).toString() + "일";
   }
  ]]>
 </mx:Script>
 
 <mx:HBox x="0" y="200" width="100%" horizontalAlign="center">
  <mx:Label text="2010년 6월 12일은"/>
  <mx:Text color="#ff0000" id="txt1"/>
  <mx:Text id="txt2"/>
 </mx:HBox>
</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
아날로그 시계  (0) 2008.02.04
디지털 시계  (0) 2008.02.03
동영상 플레이어  (0) 2008.01.11