I have a project written in ActionScript 3 using Adobe Flash Builder 4.5. It registers several functions in an ExternalInterface
, so that they may be called from JavaScript.
If I access the Flash document on a server, for example http://localhost/
, I am able to call the defined functions successfully. If I just open the file in my browser directly (through the file:///
protocol) it will fail with an error like this:
*** Security Sandbox Violation ***
SecurityDomain 'null' tried to access incompatible context 'file:///Users/foo/src/bar/baz/bin-debug/app.swf'
A reasonable security restriction, but it has a paradoxical consequence: I'm unable to debug the use of ExternalInterface
because the Flash Builder debugger opens the document through file:
.
It seems too absurd to be true that such an important feature can't be debugged normally.
How can I use the debugger with ExternalInterface
?
There are two ways to solve this:
use-network=false
compiler flag (see: http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7a92.html ctrl-f use-network)I generally prefer the latter.