Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/flash/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Flash中检测allowNetworking参数_Flash_Security_Sandbox - Fatal编程技术网

在Flash中检测allowNetworking参数

在Flash中检测allowNetworking参数,flash,security,sandbox,Flash,Security,Sandbox,您好 这是关于闪存安全/沙盒问题。我想知道是否有办法让加载的Flash.swf对象知道是否为其设置了allowNetworking=“internal”,可能是使用ActionScript(2.0或3.0) 我找到了一个,但它没有区分限制是来自allowNetworking还是allowScriptAccess设置 我不是特别想找一个变通方法(尽管这也很有趣),只是想能够检测allowNetworking是否被设置为“内部”,或者至少是“所有”之外的其他内容 干杯:)您可以通过尝试执行特定的受限

您好

这是关于闪存安全/沙盒问题。我想知道是否有办法让加载的Flash.swf对象知道是否为其设置了
allowNetworking=“internal”
,可能是使用ActionScript(2.0或3.0)

我找到了一个,但它没有区分限制是来自
allowNetworking
还是
allowScriptAccess
设置

我不是特别想找一个变通方法(尽管这也很有趣),只是想能够检测
allowNetworking
是否被设置为
“内部”
,或者至少是
“所有”
之外的其他内容


干杯:)

您可以通过尝试执行特定的受限API并查看是否抛出SecurityError来测试网络API限制

public static function getNetworkingRestriction():String {

            var result:String = "all"; // default level

            try {
                // first try SharedObject.  If it throws a SecurityError, then allowNetworking="none"
                SharedObject.getLocal("test"); 

                try {
                    // SharedObject didn't throw a SecurityError. 
                    //If ExternalInterface.call() throws a SecurityError then allowNetworking="internal"
                    ExternalInterface.call(""); 
                }
                catch (e:SecurityError) {
                    result = "internal";
                }

            }
            catch (e:SecurityError) {
                result = "none";        
            }

            return result;

        }

可以找到受限网络API的列表

您可以通过尝试执行特定的受限API并查看是否引发SecurityError来测试网络API限制

public static function getNetworkingRestriction():String {

            var result:String = "all"; // default level

            try {
                // first try SharedObject.  If it throws a SecurityError, then allowNetworking="none"
                SharedObject.getLocal("test"); 

                try {
                    // SharedObject didn't throw a SecurityError. 
                    //If ExternalInterface.call() throws a SecurityError then allowNetworking="internal"
                    ExternalInterface.call(""); 
                }
                catch (e:SecurityError) {
                    result = "internal";
                }

            }
            catch (e:SecurityError) {
                result = "none";        
            }

            return result;

        }

可以找到受限网络API列表

Thank you@colin cochrane。但是,由于行为也受
allowScriptAccess
设置的影响,因此所提出的方法不能专门/可靠地检测
allowNetworking
设置。以下是使用该方法获得的结果
allowNetworking=“all”
仅当
allowScriptAccess=“always”
或swf与
allowScriptAccess=“sameDomain”
从同一域加载时才可靠。谢谢@colin cochrane。但是,由于行为也受
allowScriptAccess
设置的影响,因此所提出的方法不能专门/可靠地检测
allowNetworking
设置。以下是使用该方法获得的结果
allowNetworking=“all”
仅当
allowScriptAccess=“always”
或swf与
allowScriptAccess=“sameDomain”从同一域加载时才可靠。