Skip to main content
DJ Gecko
Inspiring
July 24, 2015
Question

Set the value of a variable at compile

  • July 24, 2015
  • 1 reply
  • 319 views

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!

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
July 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.

DJ Gecko
DJ GeckoAuthor
Inspiring
July 24, 2015

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.