1 Reply Latest reply on Mar 5, 2010 1:07 PM by danielbala

    scope issue... launching applicaion

    danielbala

      I am having trouble calling launchApplication().

       

      I was able to narrow my problem, I think it is a scope issue, maybe you can help ( I am a .NET developer, not so much AS3)

      This code snippet is from the AIRBadge.as provided in the AIR SDK

       

      This code works:
      private var _appURL: String;
      private var _appName: String;
      private var _airVersion: String;

      private var appID:String = “com.dbala.ihpapp.app”;
      private var pubID:String = “”; //

      private var launch_args:Array = ["launchFromBrowser"];


      private function onButtonClicked(e:Event):void {

       

      _air.installApplication( _appURL, _airVersion );

       

      }

       

       

      This code does NOT work:

       

      private function onButtonClicked(e:Event):void {

       

      _air.getApplicationVersion(appID, pubID, versionDetectCallback);

       

      }

       

      private function versionDetectCallback(version:String):void{

       

      if (version == null)

      {
      //this message displays
      root.statusMessage.htmlText = "blablabla installing";

       

      //this function DOES NOT execute
      _air.installApplication( _appURL, _airVersion );

       

      //this message displays
      root.statusMessage.htmlText = "blablabla after installing";

       

      }
      else
      {

       

      //this message displays
      root.statusMessage.htmlText = "Launching Application..";

       

      //this function DOES NOT execute
      _air.launchApplication(appID, pubID, launch_args);

       

      }

       

      }

       

      I need help because it is difficult to determine if _air is accesible in versionDetectCallback

      when I trace _air, I see [object AIR] which doesn't really help me.

       

      Thanks