Recipe 3.3. Checking
the Player Type
Problem
You want to know what type of Flash Player the
.swf is being run from.
Solution
Use the
flash.system.Capabilities.playerType property.
Discussion
The different types of Flash Player include:
-
Browser plug-in that runs in web browsers such
as Mozilla or Firefox
-
ActiveX
Control used by Internet
Explorer
-
Standalone
player, which plays .swfs outside of the browser
-
External player, which is the player integrated
in the Flash IDE
There are instances when you need to know which
player the .swf is currently being run in. For example, if
you are doing any type of integration with browser scripts (e.g.,
JavaScript, VBScript), it may be important to know whether the
application is being run in Internet Explorer or some other type of
browser, as these browsers can have different behaviors when
running scripts. Indeed, it would be vital to know that the
.swf was being run in a standalone player, since JavaScript,
etc., would not be available at all in such a case.
To check the player type, look at the value of
flash.system.Capabilities.playerType. Possible values are
PlugIn, ActiveX, StandAlone, and
External. You could use this in an if
statement:
if(flash.system.Capabilities.playerType == "Plugin") {
// do actions for Mozilla, etc. browsers
}
else if(flash.system.Capabilities.playerType == "ActiveX") {
// do actions for IE
}
else {
// do actions for no browser
}
|