views:

410

answers:

1

I know that it is possible to add swf metadata to the compile command as a command option, but I can't find any documentation on how to access these metadata within the actionscript during runtime. We're trying to add a version number to the swf during compile time and then somewhere in our app we would retrieve it during runtime, here is the command example to add the description metadata.

mxmlc -description "version 1.2.3"

I know the swf metadata is used by search engines and other utilities to gather information about the SWF file, but surely you should be able to retrieve them in the actionscript during runtime?

+2  A: 

Have you tried to namespace it like this: http://hasseg.org/blog/?p=165

So maybe "-define+=VERSION::description,"version 1.2.3"

And then access it using the example code:

var VERSION:Namespace = new Namespace("VERSION");
var ver:String = VERSION::description;

EDIT: Hmm. Doesn't work for me in Flex Builder, but I found this: http://livedocs.adobe.com/flex/3/html/help.html?content=compilers_21.html, which seems to confirm the idea.

Glenn
Thanks Glenn for your answers, but they don't work for me.
Chiwai Chan
Turns out you need single quotes around the string. -define+=VERSION::version,'adas76sd687as6d'
Glenn