Articles Comments

Flex Certification » Flex Examples » Adding Version number to ContextMenu in flex.

Adding Version number to ContextMenu in flex.

build info > assets/buildInfo.txt

//Embed a text file that is autogenerated by the build process
//it contains the revsion number of the project from subversion
[Embed("assets/buildInfo.txt", mimeType="application/octet-stream")]
private static const buildInfoText: Class;

 

/**
* add the version number from the subversion generated file
* to the context menu so testers can verify what
* build they are running
*
**/
private function setUpContextMenu():void
{
    var myMenu:ContextMenu = new ContextMenu();
    myMenu.hideBuiltInItems();
    var buildTextInstance: Object = new buildInfoText();
    var buildString:String = buildTextInstance.toString();
    var findString:String = “Last Changed Rev:”;
    var revisionString:String = buildString.substr(buildString.indexOf(findString) + findString.length +1, 5);
    var menuItem1:ContextMenuItem = new ContextMenuItem(“MyApp v0.1.”+ revisionString);
    myMenu.customItems.push(menuItem1);
    this.contextMenu = myMenu;
}

Written by admin

Filed under: Flex Examples

Leave a Reply

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>