I want to check the version of my CS extension at main .mxml init time.
How does one find this version info from the manifest.xml?
Thanks,
pjb
AFAIK there is no API exposed by CSXS to get the bundle version. You can read the XML of the manifest and pull out the version though:
private function getExtensionVersion(manifestFile:File):String
{
var fileStream:FileStream = new FileStream();
fileStream.open(manifestFile, FileMode.READ);
var manifestXml:XML = XML(fileStream.readUTFBytes(fileStream.bytesAvailable));
fileStream.close();
return manifestXml.@ExtensionBundleVersion;
}
...
var version:String = getExtensionVersion(basePath.resolvePath('CSXS/manifest.xml'));
Note that basePath is a property on CSExtension.
Hope that helps,
--Louis
In your MXML file, CSExtension should be the root class. Then you can use "this.basePath":
<csxs:CSExtension xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:csxs="com.adobe.csxs.core.*" applicationComplete="appComplete()">
<fx:Script>
<![CDATA[
public function appComplete():void
{
trace(this.basePath);
}
]]>
</fx:Script>
...
</csxs:CSExtension>
North America
Europe, Middle East and Africa
Asia Pacific