Is it possible to debug ExternalInterface through file:// from Flash Builder?

非 Y 不嫁゛ 提交于 2019-12-08 01:42:52

问题


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?


回答1:


There are two ways to solve this:

  • By setting the use-network=false compiler flag (see: http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7a92.html ctrl-f use-network)
  • Configuring the Flash Builder debugger to launch the HTTP URL when debugging. To do that, click: Run -> Debug Configurations, then under "URL or path to launch", enter (say) "http://localhost/"

I generally prefer the latter.



来源:https://stackoverflow.com/questions/13034375/is-it-possible-to-debug-externalinterface-through-file-from-flash-builder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!