The docs say this :

if (Security.sandboxType == Security.APPLICATION)
{
    // Load SWF that contains AIR APIs
}
else
{
    // Load SWF that does not contain AIR APIs
}

http://livedocs.adobe.com/labs/flex3/html/help.html?content=os_shell_09.html

(I've been meaning to look this topic up recently, thanks for the reminder!)

I did expect something a bit more general rather than something that appears to 
be so closely tied to the security settings though.

If there's another way then I'd like to know about it (just so I know the 
alternatives)



-----Original Message-----
From: flexcoders@yahoogroups.com on behalf of Dale Fraser
Sent: Tue 22/01/2008 00:06
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Re: Detect AIR Application?
 
There must be an easier way.

 

The very first line of Flex vs Air app is different.

 

<mx:WindowedApplication

<mx:Application

 

There must be a way of saying, is this a Application or WindowedApplication.

 

Regards

Dale Fraser

 

http://learncf.com

 

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of rueter007
Sent: Tuesday, 22 January 2008 10:35 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Detect AIR Application?

 

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 flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> ,
"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
>

 



______________________________________________________________________
This communication is from Primal Pictures Ltd., a company registered in 
England and Wales with registration No. 02622298 and registered office: 4th 
Floor, Tennyson House, 159-165 Great Portland Street, London, W1W 5PA, UK. VAT 
registration No. 648874577.

This e-mail is confidential and may be privileged. It may be read, copied and 
used only by the intended recipient. If you have received it in error, please 
contact the sender immediately by return e-mail or by telephoning +44(0)20 7637 
1010. Please then delete the e-mail and do not disclose its contents to any 
person.
This email has been scanned for Primal Pictures by the MessageLabs Email 
Security System.
______________________________________________________________________

<<winmail.dat>>

Reply via email to