Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Set the value of a variable at compile

Engaged ,
Jul 23, 2015 Jul 23, 2015

I want to display the date when a SWF was compiled. Is there a way to set the value of a variable when a SWF is compiled?

I have this code for the context menu. But of course the date displayed is the date when the SWF is running, not when it was compiled.

var date:Date = new Date();

  var newContextMenu:ContextMenu = new ContextMenu();

  newContextMenu.customItems.push( new ContextMenuItem("Compiled Date = " + date.toString()) );

  contextMenu = newContextMenu;

Thanks!

TOPICS
ActionScript
301
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 24, 2015 Jul 24, 2015

i'm not sure that makes any sense, but you can approximate it by usin:

trace(new Date().time);

and then use that value to create your Date object.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jul 24, 2015 Jul 24, 2015
LATEST

Right now I am compiling twice, first to get the date string from a trace, then I copy that date string and paste it as the value of a variable. It's not ideal. I was hoping for a solution using something like JSFL that would generate this before I compile the SWF.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines