0 Replies Latest reply on Dec 17, 2008 10:05 AM by xbrotherx

    launchApplication throwing #2044 error

    xbrotherx Level 1
      I have a swf on a webpage that loads the air.swf API's so that I can launch an already installed AIR application using the launchApplication() method. The AIR application launches but when I tail the flashlog.txt file, all I see is a "Error #2044" iterated a couple of hundred times (no trace() statements from the app are output). When I launch the AIR application manually (double-click) my trace() statements in my app output correctly.

      I do have <allowBrowserInvocation></allowBrowserInvocation> set to 'true'. I also have my listeners in the AIR app set up for handling the BrowserInvokeEvent. My AIR app code and swf launcher code is below.

      What's up with the #2044 error? Does AIR 1.5 not handle browser invocation correctly?

      AIR Application:
      quote:


      <?xml version="1.0" encoding="utf-8"?>
      <mx:WindowedApplication xmlns:mx=" http://www.adobe.com/2006/mxml"
      xmlns:comp="components.*"
      layout="absolute" width="990" height="710"
      verticalScrollPolicy="off" horizontalScrollPolicy="off"
      showFlexChrome="false" showStatusBar="false" showGripper="true" showTitleBar="false"
      initialize="onInitialize()"
      creationComplete="onCreationComplete()">

      <mx:Script>
      <![CDATA[

      import flash.events.BrowserInvokeEvent;

      private function onBrowserInvoke(e:BrowserInvokeEvent):void {
      trace("DEBUG: onBrowserInvoke()");
      trace("\t|__ "+e.arguments);
      }

      private function onInitialize():void
      {
      trace("DEBUG: onInitialize()");
      trace("DEBUG: publisherID:"+nativeApplication.publisherID);
      trace("DEBUG: applicationID:"+nativeApplication.applicationID);
      NativeApplication.nativeApplication.addEventListener(BrowserInvokeEvent.BROWSER_INVOKE, onBrowserInvoke);
      }

      private function onCreationComplete():void
      {
      trace("DEBUG: onCreationComplete()");
      nativeWindow.x = (Capabilities.screenResolutionX - nativeWindow.width) / 2;
      nativeWindow.y = (Capabilities.screenResolutionY - nativeWindow.height) / 2;
      }
      ]]>
      </mx:Script>

      <comp:ApplicationMain showBreakAwayButton="true" width="100%" height="100%" />

      </mx:WindowedApplication>




      SWF Launcher:
      quote:

      package {
      import flash.display.*;
      import flash.events.*;
      import flash.geom.ColorTransform;
      import flash.net.URLRequest;
      import flash.system.*;
      import flash.text.TextField;

      // AIRBadge is our main document class
      public class LaunchApplication extends MovieClip {

      private const BROWSERAPI_URL_BASE: String = " http://airdownload.adobe.com/air/browserapi";

      private var _applicationID:String;
      private var _publisherID:String;
      private var _arguments: Array;

      private var _loader:Loader;
      private var _air:Object;

      public function LaunchApplication() {

      _loader = new Loader();
      var loaderContext:LoaderContext = new LoaderContext();
      loaderContext.applicationDomain = ApplicationDomain.currentDomain;

      _loader.contentLoaderInfo.addEventListener(Event.INIT, onInit);
      _loader.load(new URLRequest(BROWSERAPI_URL_BASE + "/air.swf"), loaderContext);

      var parameters:Object = LoaderInfo(this.root.loaderInfo).parameters;
      _applicationID = "com.application.telnetPrototype";
      _publisherID = "55C8A271BCBC06DBE0D19C7886420261D1D77123.1";
      _arguments = String(parameters["arguments"]).split(",");
      }

      private function onInit(e:Event):void {
      _air = e.target.content;
      switch (_air.getStatus()) {
      case "installed" :
      statusMessage.text = "AIR is installed and has been detected."
      launchButton.buttonMode = true;
      launchButton.useHandCursor = true;
      launchButton.addEventListener(MouseEvent.CLICK,onButtonClicked);
      break;
      case "available" :
      // AIR is Available
      statusMessage.text = "AIR is not installed - application cannot be launched."
      break;
      case "unavailable" :
      // AIR Not Available
      statusMessage.text = "AIR is not installed - application cannot be launched."
      break;
      }
      }

      private function onButtonClicked(e:Event):void {
      statusMessage.text = "Attempting to Launch AIR Application";
      _air.launchApplication(_applicationID, _publisherID, _arguments);

      }
      }
      }