接下來的例子演示了Flex中通過和Security類中的常量(LOCAL_TRUSTED, LOCAL_WITH_FILE, LOCAL_WITH_NETWORK以及REMOTE)對比sandboxType屬性,檢查應(yīng)用程序當(dāng)前安全沙盒設(shè)置。下面是完整代碼:復(fù)制代碼代碼如下:<?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>
新聞熱點(diǎn)
疑難解答