2007年1月17日星期三

3.3.检测播放器类型


3.3. 检测播放器类型

问题
我想知道播放器类型You want to know what type of Flash Player the .swf is being run from.
解决办法
使用 flash.system.Capabilities.playerType 属性.
讨论

播放器的类型有:
浏览器插件形式存在于 Mozilla 或 Firefox
ActiveX 控件形式存在于Internet Explorer
独立播放器
外部播放器,它与Flash IDE进行交互。


这些都是.swf 运行的环境,如果你要使用脚本进行交互,这就需要知道应用程序到底在Internet Explorer 或其他的浏览器运行。如果在独立播放器里运行,那么JavaScript等脚本就不管用了。
检测播放器类型,察看flash.system.Capabilities.playerType 的值。它可能是PlugIn, ActiveX, StandAlone, External
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
}


没有评论: