views:

1082

answers:

1

How to monitor version in swf file when we compile a swf file in Adobe Flex file?

+4  A: 

Assuming I understand your question correctly, you should check out this blog post of mine, titled "Saving and Accessing Version/Compilation Information with Flex Applications", which goes on to explain how you can use the conditional compilation feature in the mxmlc compiler to save variable values into the compiled binary and then print them to the log (or display in the user interface) within the app itself.

Here are the relevant snippets from that post:

# Compiling the binary with the conditional compilation parameter:
/path/to/mxmlc -define+=DEBUG::compiled,"Fri_Sep_12_17:26:13_on_Alis-MacBook.local" -strict=true /path/to/myApp.mxml

// Printing out the "compiled" value in the application code:
var DEBUG:Namespace = new Namespace("DEBUG");
var compiledStr:String = DEBUG::compiled;
trace("SWF was compiled: "+compiledStr);

As far as the actual "version number" goes, I just use three things:

  • the compilation date (see the example scripts in the post for info on how to automate this)
  • the hostname of the computer where it was compiled (also demonstrated in the post)
  • the SVN revision of the working copy (see my answer to this question for info on how to get the SVN revision number)
hasseg
Do you know of an easy way to automate this in Flex Builder so that I don't have to update the compiler options manually every time?
RickDT
No, I don't :( I would suggest using a script to do that for you and bind that to a keycombo in FB. The problem then becomes the fact that mxmlc is a lot slower than fcsh (which FB uses) but I've researched some options for automating fcsh usage as well: http://hasseg.org/blog/?p=194
hasseg