How to check if a SWF is running as an AIR app?

I'm wondering if there is a way for a SWF to check at runtime whether it is running as an online SWF or an AIR app? I need to use the same SWF to run both online and locally, however when running as an AIR app, external assets are located in a different directory. I'd like to check whether a SWF is local or online so I can change the source path for external assets accordingly.

Thanks, Sandro

Edit: I just realized this might be a dumb question. :) I may just use flashvars to tell the SWF that it is running within an AIR app.


You can use the Capabilities class.

import flash.system.Capabilities;

switch (Capabilities.playerType) {
    case 'Desktop':
        //air runtime
    case 'PlugIn':
    case 'ActiveX':

Further information from Adobe's ActionScript 3 Reference.

Need Your Help

Redundant assert statements in .NET unit test framework

c# .net visual-studio unit-testing nunit

Isn't it true that every assert statement can be translated to an Assert.IsTrue, since by definition, you are asserting whether something is true or false?

LGPL-like license for a header-only C++ library

c++ templates open-source licensing libraries

My understanding is that a program can link dynamically to an LGPL library and include its headers, possibly with modifications, without the program having to be released under the LGPL, but any