There probably might be different ways. But I use the following trick.

I create a class called Version.as in my Flex project under a specific
package.

package com.mycompany.xxxx
{
  public class Version
  {
    public static const HAS_AIR:Boolean = false;
  }
}

I create the exact same package and class in my AIR project but with a
different value for the constant

package com.mycompany.xxxx
{
  public class Version
  {
    public static const HAS_AIR:Boolean = true;
  }
}

The common classes are in a common project and both of them refer to
the common project. Now, anywhere you want to check which version you
are running, you just need to check Version.HAS_AIR and you will know
if you are running FLEX or AIR.

- venkat
http://www.venkatj.com

--- In [email protected], "Dale Fraser" <[EMAIL PROTECTED]> wrote:
>
> I have an application that runs both in browser (Flex) and
standalone (Air).
> 
>  
> 
> But the application does different things depending if it is Flex or
Air.
> 
>  
> 
> I currently have two versions, but would like to just have one.
> 
>  
> 
> Is there a way of detecting if it is running as AIR / Flex so that for
> example my close button would
> 
>  
> 
> In Air close the window
> 
> In Flex navigate to a different URL.
> 
>  
> 
> I'm after something like
> 
>  
> 
> If (applicationMode == AIR) {
> 
>      Blah!
> 
>  
> 
> Regards
> 
> Dale Fraser
> 
>  
> 
> http://learncf.com
>


Reply via email to