Flex中通过和Security类中的常量(LOCAL_TRUSTED, LOCAL_WITH_FILE, LOCAL_WITH_NETWORK以及REMOTE)对比sandboxType属性检查应用程序当前安全沙盒设置的例子
By Minidxer | September 21, 2008
接下来的例子演示了Flex中通过和Security类中的常量(LOCAL_TRUSTED, LOCAL_WITH_FILE, LOCAL_WITH_NETWORK以及REMOTE)对比sandboxType属性,检查应用程序当前安全沙盒设置。
让我们先来看一下Demo(可以右键View Source或点击这里察看源代码):
下面是完整代码(或点击这里察看):
Download: main.mxml
- <?xml version="1.0" encoding="utf-8"?>
- <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
- layout="vertical"
- verticalAlign="middle"
- backgroundColor="white"
- creationComplete="init();">
- <mx:Script>
- <![CDATA[
- private function init():void {
- switch (Security.sandboxType) {
- case Security.LOCAL_TRUSTED:
- sandboxLabel.text += " (Local trusted)";
- break;
- case Security.LOCAL_WITH_FILE:
- sandboxLabel.text += " (Local with file)";
- break;
- case Security.LOCAL_WITH_NETWORK:
- sandboxLabel.text += " (Local with network)";
- break;
- case Security.REMOTE:
- sandboxLabel.text += " (Remote)";
- break;
- }
- }
- ]]>
- </mx:Script>
- <mx:Form>
- <mx:FormItem label="Security.sandboxType:" fontSize="16">
- <mx:Label id="sandboxLabel" text="{Security.sandboxType}" />
- </mx:FormItem>
- </mx:Form>
- </mx:Application>
代码:Peter deHaan 翻译/整理/编译:中文Flex例子
Topics:
Other |
No Comments » |
Tags: sandboxType, Security, 安全沙盒