2009-10-21 59 views
0

我正在尋找與AS3中編譯時常量等效的C/C++的__TIME____DATE__。我希望能夠在瑞士法郎建成時進行烘焙。在AS3中是否有與__DATE__等價的東西?

我可以寫一個構建腳本或JSFL某處更新恆定的,但我希望有內置的東西。

+0

__TIME__和__DATE__都來自什麼語言?或者你是指編譯器變量? – 2009-10-21 18:38:30

+0

'__TIME__'和'__DATE__'是舊行爲腳本2語言的存根,將在系統運行時填入。 – 2009-10-21 18:45:12

+0

是的,我正在尋找AS3的編譯時解決方案。 – scobi 2009-10-21 19:02:16

回答

0

這只是兩個__DATE____TIME__

new Date(); 

見這個例子下面介紹如何使用它。你可以找到documentation here

/** 
* Called by the parent container when the display is being drawn. 
*/ 
public override function draw():void 
{ 
    // stores the current date and time in an instance variable 
    currentTime = new Date(); 
    showTime(currentTime); 
} 

/** 
* Displays the given Date/Time in that good old analog clock style. 
*/ 
public function showTime(time:Date):void 
{ 
    // gets the time values 
    var seconds:uint = time.getSeconds(); 
    var minutes:uint = time.getMinutes(); 
    var hours:uint = time.getHours(); 

    // multiplies by 6 to get degrees 
    this.secondHand.rotation = 180 + (seconds * 6); 
    this.minuteHand.rotation = 180 + (minutes * 6); 

    // Multiply by 30 to get basic degrees, then 
    // add up to 29.5 degrees (59 * 0.5) 
    // to account for the minutes. 
    this.hourHand.rotation = 180 + (hours * 30) + (minutes * 0.5); 
} 
+0

對不起,我的意思是來自C/C++世界的__DATE__和__TIME__。編譯時間常量,而不是運行時間。我會更新這個問題。 – scobi 2009-10-21 18:59:51

相關問題