0 Replies Latest reply on May 20, 2009 4:45 PM by Hironmay


    Hironmay Level 4



      I built a flex App and I was trying to launch an AIR app after loading airSWF by looking at various posts in the forum. My airSWF.getStatus() always shows  'available' instead of 'installed' even though I have AIR installed on my system and I can run AIR apps. Is there something I am missing out ? Here is the code attached, it's simple. It just user loads airSWF and tries to call its APIs but since the AIR isnt installed, it fails.


      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="onCreationComplete()">
               private var appID:String = "TestAirApp";
               private var pubID:String = "CA9DDEAF7D7360C95C34185B3C13953A5D184161.1" //"8B00A63502B9D572EACB3881FACBB40FCDF23135.1" ;
              public function onCreationComplete():void
                  var loader:Loader = new Loader();
                  loader.contentLoaderInfo.addEventListener(Event.INIT, function(e:Event):void {
                      try {
                          var airSWF:Object = e.target.content;
                          var status:String = airSWF.getStatus();
                          if ((status == 'available') || (status == 'installed')) {
                              airSWF.getApplicationVersion(appID, pubID,function(airVersion:String):void{
                                  if (airVersion != null) {
                                      downloadButton.label = 'Launch AIR Version';
                                      downloadButton.addEventListener(MouseEvent.CLICK,function():void {
                                              airSWF.launchApplication(appID, pubID);
                                  if (downloadButton.label.indexOf('Launch') == -1) {
                                      downloadButton.addEventListener(MouseEvent.CLICK,function():void {
                                  downloadButton.enabled = true;
                      catch (e:Error) {
                          trace('Error installing or checking for AIR version:\n\n' + e.message);
                  var loaderContext:LoaderContext = new LoaderContext();
                  loaderContext.applicationDomain = ApplicationDomain.currentDomain;
                  new URLRequest(" http://airdownload.adobe.com/air/browserapi/air.swf"),
          <mx:Button id="downloadButton" label="Install Local Connection" />