zoukankan      html  css  js  c++  java
  • 如何使用ActionScript来检测用户的操作系统种类及浏览器类型

    检测用户的操作系统的代码

    package

    {
        import flash.display.Sprite;
        import flash.system.Capabilities;

        public class VarTest extends Sprite
        {
            public 
    function VarTest()
            {
                super();
                graphics.lineStyle(
    3,9,1);
                
    var os:String =flash.system.Capabilities.os.substr(0,3);
                
    if (os == "Win") {
                  
    // Windows-specific code goes here
                graphics.lineTo(100,300);
                } 
    else if (os == "Mac") {
                  
    // Mac-specific code goes here
                  graphics.lineTo(500,200);
                } 
    else {
                  
    // Must be Unix or Linux
                }
            }
            
        }

    }

    检测用户浏览器的代码

       var playType:String=flash.system.Capabilities.playerType;

       if(playType=="Plugin")

       {

        //do actions for mozilla,etc.browser

        graphics.beginFill(0xff0000);

        graphics.drawRect(0,0,30,30);

        graphics.endFill();

       }

       else if(playType=="ActiveX")

       {

        //do actions for ie

        graphics.beginFill(0x00ff00);

        graphics.drawRect(50,50,40,40);

        graphics.endFill();

       }

       else

       {

        //do actions from no browser

       }     


  • 相关阅读:
    初始WebApi(1)
    百度编辑器UEditor,保存图片的配置问题
    通过简单的ajax验证是否存在已有的用户名
    .NET MVC中登录过滤器拦截的两种方法
    MySQL数据库innodb_rollback_on_timeout参数
    MySQL如何删除#sql开头的临时表
    SQL基础(2)
    ORDER BY导致索引使用不理想
    SQL基础
    MySQL传统点位复制在线转为GTID模式复制
  • 原文地址:https://www.cnblogs.com/sunbingzibo/p/1459113.html
Copyright © 2011-2022 走看看