Determining whether a SWF is running in the IDE or a browser

Here’s something that’s been around for a while that I didn’t learn about until just recently.

The flash.system.capabilities.playerType property can be used to tell whether you’re running in the browser, a standalone player, or the Flash IDE. It returns the following values (from Adobe’s documentation):

  • “ActiveX” for the Flash Player ActiveX control used by Microsoft Internet Explorer
  • “Desktop” for the Adobe AIR runtime (except for SWF content loaded by an HTML page, which has Capabilities.playerType set to “PlugIn”)
  • “External” for the external Flash Player or in test mode
  • “PlugIn” for the Flash Player browser plug-in (and for SWF content loaded by an HTML page in an AIR application)
  • “StandAlone” for the stand-alone Flash Player

Simply check for (flash.system.capabilities.playerType == "ActiveX" || flash.system.capabilities.playerType == "PlugIn") and you’ll know you’re in a browser.

Advertisements

, , ,

  1. Leave a comment

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: