2 Replies Latest reply on Nov 25, 2008 8:54 AM by hammdo

    Check if Running Locally or Online

    patgeiger Level 1
      Hi - I'm currently building a very small basic app (built in Flash) that is to be deployed online as well as with AIR. This is the fist time I have used AIR. I was looking for a function that will tell me if the application is running online as an SWF or as an AIR application (for the few instances in which the code will differ). This will enable me to keep the exact same code base and just publish the file 2 ways.

      Thanks in advance for any help.

        • 1. Re: Check if Running Locally or Online
          markh Level 1
          One difference is that the Application class for each will be different - flex uses Application class, while an Air uses WindowsApplication. The app instance could be passed into the main code and it's type checked e.g.

          <mx:WindowedApplication creationComplete="init(this)">
          <mx:Application creationComplete="init(this)">
          function init(app:Object):void
          if (app is WindowedApplication)
          //Air code
          else if (app is Application)
          //Flex code
          • 2. Re: Check if Running Locally or Online
            Actually, Air can use mx:Application if you want to use a 'chromless' app with a custom background/skin (no title bar, no min/max/close buttons). I've done this and its the main mxml file in the Air app.