ActionScript3检测操作系统

package {
import flash.display.Sprite;
import flash.system.Capabilities;
import flash.text.TextField;

public class EnvironmentTest extends Sprite
{
   public function EnvironmentTest()
   {
     var textfield:TextField;
   
    //检测操作系统
    var os:String=flash.system.Capabilities.os.substr(0,3);
   
    //检查播放器类型
    var playertype:String=flash.system.Capabilities.playerType;
   
    //检测系统语言
    var lang:String=flash.system.Capabilities.language;
   
    //检测屏幕分辨率
    var screenx:int=flash.system.Capabilities.screenResolutionX;
    var screeny:int=flash.system.Capabilities.screenResolutionY;
    var screencolor=flash.system.Capabilities.screenColor;
   
    textfield=new TextField();
    textfield.text="os: "+os+"\r\n"+"playertype: "+playertype+"\r\n"+"lang: "+lang+"\r\n"
                           +"x:y:color: "+screenx.toString()+":"+screeny.toString()+":"+screencolor+"\r\n";
            this.addChild(textfield);            
   }
}
}

你可能感兴趣的:(OS,Flash)