Domanda

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?

È stato utile?

Soluzione

static public function callExternal( str:String ):void
{
    try
    {
        ExternalInterface.call( str );
    }
    catch( e:SecurityError )
    {
        trace( 'handle no external interface' );
    }
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top