在AS3中是否有相当于__DATE__的内容?

时间:2009-10-21 18:35:51

标签: actionscript-3

我正在寻找AS3中C / C ++的__TIME____DATE__编译时常量的等价物。我希望能够在瑞士法郎建成时进行烘烤。

我可以编写一个构建脚本或JSFL来更新某个常量,但我希望有内置的东西。

2 个答案:

答案 0 :(得分:2)

我相信这就是你要找的东西:

Flex: Figure out when the running swf was compiled?

答案 1 :(得分: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);
}