문제

I have a swf that runs on many sites, most of which allow script access. For those that don't, I'm trying to catch errors but having no luck. (I'm also checking to see if ExternalInterface.available is true, but the Flash Player always tells me it is.)

static public function callExternal(str:String):Object {
        var result:*;
        try {
            result = ExternalInterface.available?ExternalInterface.call(str):null;
        } catch (e:Error) {
            log.exception(e);
        }
        return result;
    }

And this is what I get in the log:

SecurityError: Error #2060: Security sandbox violation: ExternalInterface caller 
(my swf) cannot access (some site)

What can I do to either prevent this call from being made when I don't have permission or catch the security error after the fact?

도움이 되었습니까?

해결책

static public function callExternal( str:String ):void
{
    try
    {
        ExternalInterface.call( str );
    }
    catch( e:SecurityError )
    {
        trace( 'handle no external interface' );
    }
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top