9 Replies Latest reply on Jan 18, 2010 1:24 PM by tedalde2

    Adobe Air Deployment Questions

    danbucholtz1 Level 1

      I'm working on a commercial application.  This application gets sold to customers, then deployed by various customers on whatever server they would like.  It's a java backend flex front end.  That said, for the web-app, since the swf file is housed in an application server within the same context/webroot as the server-side code, I can use relative url's.


      For example, I can reference everything through /application/servlet/fun versus a full url


      This is a huge advantage for a web app because I can sell my product and they can deploy it wherever they want without me having to recompile or anything like that to account for new URLs.


      Is there a way to do something similar with Adobe Air?  I would like the use the Air environment for my next iteration of the app if possible because it gives added screen space (cuts out a lot of the browser stuff).


      Currently, I put all my url's in .properties files.  So, I would have a property like this:


      MAIN_SERVLET=/application/servlet/fun (for example)


      I could still have a concept like this, but how does a desktop app know the relative url path to the application server?  Thus, I don't think you can use relative urls.


      Please guide me in the right direction.  I've been googling this all morning trying to understand the deployment process but I've found the documentation to be lacking.





        • 2. Re: Adobe Air Deployment Questions
          tedalde2 Level 2

          You're looking for something like URLRequest.setDefaultRoot(somepath) which unfortunately doesn't exist. So you probably need to modify your url properties to include the domain, or rewrite all of your url requests to concatenate the domain and url path.

          • 3. Re: Adobe Air Deployment Questions
            danbucholtz1 Level 1

            I understand that I could use a .property file or several other means of accomplishing this through code.


            The problem is that every customer I sell my application to likely has a different server url.  Having said that, is there a way to reference the url externally (external xml file, for example) versus having something compiled in?  I'm having a hard time finding information on this.  I would like to compile the app once (one swf for a release), and give that swf to everyone, then have them enter in the url of the server in an external file.

            • 4. Re: Adobe Air Deployment Questions
              heavyboots Level 2

              EDIT: I guess I see the advantage of using XML in your case, as you could probably just specify that the XML file should be installed in the user Documents folder or same folder as the application or something to limit where you had to look for it.


              XML files are easy too. Essentially something like:



                function loadData(event):void  {
                 /* DESCRIPTION: Read XML from selected file */
                 var stream:FileStream = new FileStream();
                 stream.open(event.target, FileMode.READ);
                 myXML = XML(stream.readUTFBytes(stream.bytesAvailable));
                 trace('xml loaded');
                 Globals.lastLoadPath = event.target.url;
                function readXML(xml:XML):String{
                /* DESCRIPTION: Parse XML   */
                 var defaultServer:String = "";
                 for each( var element in xml.children() ) {
                  if( element.child("defaultServer").length() > 0 ) {
                    defaultServer = element.defaultServer;
                    return defaultServer;
              • 5. Re: Adobe Air Deployment Questions
                tedalde2 Level 2

                So the problem is where to tell the app to look for the domain definition. If you don't want to re-sign your app for every customer, heavyboots is right, you'll need to build in some kind of hardcoded path (Documents folder, a known service on your domain, or otherwise...) with a file that defines the domain. If you want to re-sign the AIR app for each customer, then just define the (default) domain in the app folder somewhere, just like your properties file. Also, AIR 2 (beta) gives the option for external installers, so you might be able to install the domain definition file that way too.

                • 6. Re: Adobe Air Deployment Questions
                  Joe ... Ward Level 4

                  One way to handle the task of telling an AIR app which server to connect to, is to install via a badge on a web page. You can then pass in the server URL to the app as an argument.

                  • 7. Re: Adobe Air Deployment Questions
                    tedalde2 Level 2

                    Ah, right, the badge is probably the best way. The user gets the install and domain all from the web page; easy for the user. The badge or some other SWF could also be configured to invoke the app if installation had already happened.

                    • 8. Re: Adobe Air Deployment Questions
                      danbucholtz1 Level 1

                      This seems like a totally reasonable thing to do and seems like the path I will take.


                      Hi – I’m confused as to how this works.

                      I’ve followed this tutorial http://www.davidtucker.net/2008/01/10/air-tip-5-passing-arguments-to-an-application-on-ins tall/comment-page-1/#comment-3720


                      yet the BrowserInvokeEvent does not seem to be invoked.  This is the application compiled into the .air app.  On the preInitialize event, I do the following code:


                      private function initResources():void{
                      NativeApplication.nativeApplication.addEventListener(BrowserInvokeEvent.BROWSER_INVOKE, onInvokeEvent);
                      Swiz.loadBeans( [Beans] );


                      As you can see, I subscribe to the event and prepare my swiz framework beans.  That’s all.

                      Having said that, the listener is never called. I have the following code in place to debug and see what data I’d be receiving from the flashvars.


                      private function onInvokeEvent(invocation:BrowserInvokeEvent):void {
                      Alert.show(”BrowserInvokeEvent handler”);
                      var arguments:Array = invocation.arguments;
                      for each ( var object in arguments ){
                      Alert.show(”argument is ” + object + ” or ” + object.data );


                      Am I missing a step such as recompiling the Badge.swf with the new contents of AIRBadge.as ?

                      Thanks in advance, I’m very stumped by this.  Any guidance will be appreciated.


                      • 9. Re: Adobe Air Deployment Questions
                        tedalde2 Level 2

                        I didn't thoroughly read the tutorial, but does the app get invoked by the badge? What happens if the app is already open? Is the badge running locally or on a server (maybe a sandbox issue)?