import flash.system.Capabilities;
var pType:String = String(Capabilities.playerType);
if (pType == "Plugin" || pType == "ActiveX") {/* swf is running a browser */};
if (pType == "Desktop") {/* swf is running in a desktop AIR application */};
if (pType == "StandAlone") {/* swf is running in a standalone Flash Player */};
if (pType == "External") {/* swf is running in the Flash IDE preview player */};