UPDATE: It appears that if you set ExternalInterface.marshallExceptions
to true
, the errors will be re-enabled.
Here’s a third ExternalInterface
bug I discovered while developing the YUI Charts. When you call an ActionScript function from JavaScript, and an error is thrown by Flash Player, the standard error popup in the debug version of Flash Player will not display. This bug only appears in Flash Player 9 Update 3 (version 9.0.115), and it does not affect earlier versions.
This problem affected me on multiple occasions while I was using the beta version of Update 3 from Labs (though I only discovered it after the release) and again just a couple of days ago. I have trouble reproducing or tracking down certain bugs that others report because errors during calls from JavaScript simply fail silently on my machine like if I had the release player.
Let’s look at a simple example application below. When the constructor runs, it exposes the displayError()
function to JavaScript. This function does nothing more than throw an error. The constructor then calls a flashReady()
function through ExternalInterface to notify the HTML page that the SWF is finished loading.
package { import flash.display.Sprite; import flash.external.ExternalInterface; public class ExternalInterfaceActionScriptError extends Sprite { public function ExternalInterfaceActionScriptError() { ExternalInterface.addCallback("displayError", displayError); ExternalInterface.call("flashReady"); } public function displayError():void { throw new Error("This error will not display in 9.0.115!"); } } }
The flashReady()
function in JavaScript appears below. The ${application}
is simply the replacement token used by Flex Builder HTML templates for the object/embed id in the page.
<script type="text/javascript"> function flashReady() { ${application}.displayError(); } </script>
If you have Flash Player 9.0.47 debug installed, an error will be displayed. If you have 9.0.115 installed, you will see nothing. Once again, I intend to submit the bug to Adobe so that it may be fixed in an upcoming release of Flash Player. If you’ve found any Flash Player bugs, and you can reproduce them, always be sure to let Adobe know. It may not help immediately, but you’ll be thankful when they’re fixed in the future.
does the parameter — allowScriptAccess in the HTML be setting?