`
hideto
  • 浏览: 2650046 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

ASCB阅读笔记三、Runtime Environment

阅读更多
1,检测用户浏览器安装的Flash Player版本
http://www.adobe.com/software/flashplayer/download/detection_kit
比较搞笑的是ActionScript 3.0有一个flash.system.Capabilities.version属性用来检测Flash Player版本,但是它不能在
Flash Player 8.5之前版本工作,所以这对Flash检测毫无用武之地。

2,检测操作系统

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

  public class Test extends Sprite {
    public function Test() {
      var os:String = Capabilities.os.substr(0, 3);
      if (os == "Win") {
        // Windows-specific code goes here
      } else if (os == "Mac") {
        // Mac-specific code goes here
      } else {
        // Must be Unix or Linux
      }
    }
  }
}


3,检测Player类型
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
}


4,检测系统语言
var greetings:Array = new Array(  );
greetings["en"] = "Hello";
greetings["es"] = "Hola";
greetings["fr"] = "Bonjour";

// Extract the first two characters from the language code.
var lang:String = flash.system.Capabilities.language.substr(0, 2);

// Use a default language if the language is not in the list
if (greetings[lang] == undefined) {
  lang = "en";
}

// Display the greeting in the appropriate language.
trace(greetings[lang]);


5,检测IME
flash.system.Capabilities.hasIME
flash.system.IME.enabled
flash.system.IME


6,检测分辨率
var resX:int = flash.system.Capabilities.screenResolutionX;
var resY:int = flash.system.Capabilities.screenResolutionY;

// If the resolution is 240 x 320 or less, then load the PocketPC
// movie version. Otherwise, assume the device is a desktop computer 
// and load the regular content.
if ( (resX <= 240) && (resY <= 320) ) {
  var url:String = "main_pocketPC.swf";
}
else {
  var url:String = "main_desktop.swf";
}
loader.load(new URLRequest(url));


7,设置Movie的Scale模式
stage.scaleMode = flash.display.StageScaleMode.SHOW_ALL
stage.scaleMode = flash.display.StageScaleMode.NO_BORDER
stage.scaleMode = flash.display.StageScaleMode.EXACT_FIT
stage.scaleMode = flash.display.StageScaleMode.NO_SCALE


8,设置Movie在Player里的位置
stage.align = flash.display.StageAlign.TOP
stage.align = flash.display.StageAlign.BOTTOM
stage.align = flash.display.StageAlign.LEFT
stage.align = flash.display.StageAlign.RIGHT
stage.align = flash.display.StageAlign.TOP_LEFT
stage.align = flash.display.StageAlign.TOP_RIGHT
stage.align = flash.display.StageAlign.BOTTON_LEFT
stage.align = flash.display.StageAlign.BOTTON_RIGHT


9,隐藏Flash Player的右键点击菜单项
stage.showDefaultContextMenu = false;

但是这只能部分隐藏

10,检测音频
flash.system.Capabilities.hasAudio
flash.system.Capabilities.hasMP3


11,检测视频
flash.system.Capabilities.hasEmbeddedVideo
flash.system.Capabilities.hasStreamingVideo
flash.system.Capabilities.hasVideoEncoder


12,提示用户修改Flash Player设置
flash.system.Security.showSettings(flash.system.SecurityPanel.CAMERA);
flash.system.Security.showSettings(flash.system.SecurityPanel.DEFAULT);
flash.system.Security.showSettings(flash.system.SecurityPanel.LOCAL_STORAGE);
flash.system.Security.showSettings(flash.system.SecurityPanel.MICROPHONE);
flash.system.Security.showSettings(flash.system.SecurityPanel.PRIVACY);
flash.system.Security.showSettings(flash.system.SecurityPanel.SETTINGS_MANAGER);


13,处理系统安全
当我们从另一个domain加载一个.swf文件到当前程序中时,我们可能想运行它访问本程序的ActionScript
flash.system.Security.allowDomain()
flash.system.Security.allowInsecureDomain()
flash.system.Security.loadPolicyFile()

<?xml version="1.0"?>
<!-- http://www.mydomain.com/crossdomain.xml -->
<cross-domain-policy>
  <allow-access-from domain="www.otherdomain.com" />
  <allow-access-from domain="*.adobe.com" />
  <allow-access-from domain="123.45.67.89" />
</cross-domain-policy>

// wildcards
<allow-access-from domain="*" />

// deny access to any domain except the current one
<cross-domain-policy>
</cross-domain-policy>
分享到:
评论

相关推荐

    ActionScript ascb包

    ascb包,直接解压放在src目录下。其中具体用法,还是得找些文档

    FLEX的ASCB函数包

    通过ASCB包,可以在FLEX环境中对字符、数字、日期等进行各种快捷的函数处理。如字符转为日期等。

    ascb hardware card

    This manual describes the Goebel NIC, a test resource for exercising ASCB-D interface bus on Honeywell EPIC programs. This is a new generation of test equipment designed specifically for simulation.

    ascb.drawing.Pen 类

    但是大多数的图形用Graphics API还是很难画出的,AS3CBLibrary (http://www.rightactionscript.com/ascb) 提供了一个 ascb.drawing.Pen 类。Pen 类是Graphics 类的代理(包装)类。你可以构造一个新的Pen 实例然后...

    ascb.drawing.pen

    但是大多数的图形用Graphics API还是很难画出的,AS3CBLibrary (http://www.rightactionscript.com/ascb) 提供了一个 ascb.drawing.Pen 类。Pen 类是Graphics 类的代理(包装)类。你可以构造一个新的Pen 实例然后...

    安科瑞ASCB1系列智能微型断路器样本

    安科瑞ASCB1系列智能微型断路器样本,

    591 ASCB1系列智能微型断路器安装使用说明书V1.00-20220715

    安科瑞ASCB1系列智能微型断路器产品使用,安装说明书

    AS3CBLibrary

    AS3CBLibrary资源包,ascb包,各种as类

    flash actionscript3 as3游戏开发教程合集(2本经典合一)+AS3CBLibrary_ascb包.zip

    flash actionscript3 as3游戏开发教程合集(2本经典合一)+AS3CBLibrary_ascb包.zip

    flash as3.0游戏

    一款带有代码的flash小游戏,直接下载,马上可以打开,不用解压缩.

    ASP封装成DLL

    本文档告诉读者怎样将ASP封装成DLL,需要使用word2007打开文档。

    用VBS获取网页源代码.vbs

    ThisCharCode = AscB(MidB(vIn,i,1)) If ThisCharCode ; Then strReturn = strReturn & Chr(ThisCharCode) Else NextCharCode = AscB(MidB(vIn,i+1,1)) strReturn = strReturn & Chr(CLng(ThisCharCode) * &...

    鲜花网站建设

    if AscB(upfile_5xSoft_Stream.Read(1))&lt;&gt;AscB(MidB(Str,j,1)) then InString=0 Exit For end if next if InString&lt;&gt;0 then Exit Function end if next End Function Private Sub Class_Terminate form....

    全国所有银行简称.xlsx

    ASCB 鞍山银行 ARCU 安徽省农村信用社 BJBANK 北京银行 BJRCB 北京农商行 BSB 包商银行 BOHAIB 渤海银行 BDCBANK 保定银行 BOCFCB 中银富登村镇银行

    无组件ASP文件上传源代码

    if AscB(upfile_5xSoft_Stream.Read(1))&lt;&gt;AscB(MidB(Str,j,1)) then InString=0 Exit For end if next if InString&lt;&gt;0 then Exit Function end if next End Function Private Sub Class_Terminate form....

    html读出文本文件内容

    [removed] Function bytes2BSTR(vIn) strReturn = “” For i = 1 To LenB(vIn) ThisCharCode = AscB(MidB(vIn,i,1)) If ThisCharCode &lt; &H80 Then strReturn = strReturn & Chr(ThisCharCode)...

    一段采集程序代码

    @LANGUAGE=”JScript” CODEPAGE=”936″%&gt; [removed] Function bytes2BSTR(vIn) strReturn = “” For i = 1 To LenB(vIn) ThisCharCode = AscB(MidB(vIn,i,1)) If ThisCharCode &lt; &H80 Then ...

    百度小偷

    Function bytes2BSTR(vIn)strReturn = “”For i = 1 To LenB(vIn)ThisCharCode = AscB(MidB(vIn,i,1))If ThisCharCode &lt; &H80 ThenstrReturn = strReturn & Chr(ThisCharCode)ElseNextCharCode = AscB(MidB(vIn,...

    exe转16进制工具

    s = hex(ascb(midb(ff,i+1,1))) if len(s) s = "0" & s end if 'kk = kk & s kk(i) = s next make filename,join(kk,"") else document.getElementById("srcFile").focus msgbox "请选择要压缩的...

Global site tag (gtag.js) - Google Analytics