AS3 检测当前Flash Player运行的版本类型

flash.system.Capabilities.playerType

不同的Flash Player版本类型:

  • Browser plug-in// 运行在 Mozilla 或者 Firefox 的Flash Player

  • ActiveX //用于Internet Explorer的Flash Player

  • Standalone player  //以Flash Player作为独立播放器

  • External player //结合Flash IDE的Flash Player播放器                                                                             

下面是实现效果的代码:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="initApp()">
 <mx:Script>
  <![CDATA[
   import mx.controls.Alert;
   
   public function initApp():void{
    var playerType:String;
    playerType = "n" + flash.system.Capabilities.playerType;
    
    if(flash.system.Capabilities.playerType == "Plugin") {
      // do actions for Mozilla, etc. browsers
      Alert.show("flash.system.Capabilities.playerTyp:" + playerType);
    }
    else if(flash.system.Capabilities.playerType == "ActiveX") {
      // do actions for IE
      Alert.show("flash.system.Capabilities.playerTyp:" + playerType);
    }
    else {
      // do actions for no browser
      Alert.show("flash.system.Capabilities.playerTyp:" + playerType);
    }
   }
  ]]>
 </mx:Script>
</mx:Application>

 

Advertisements

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

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

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d 博主赞过: