In Actionscript 3, I make a call to Javascript using:
ExternalInterface.call('javascriptFunction');
If in Javascript, there's an error or a blocking call, the entire browser will freeze. I can't use Firebug in Firefox to debug it because the act of stepping through the callback also crashes the browser. How do I go about debugging this?
function javascriptFunction() {
alert('called from AS3');
// OR
nonExistent.madeUp();
}
In Actionscript 3, I make a call to Javascript using:
ExternalInterface.call('javascriptFunction');
If in Javascript, there's an error or a blocking call, the entire browser will freeze. I can't use Firebug in Firefox to debug it because the act of stepping through the callback also crashes the browser. How do I go about debugging this?
function javascriptFunction() {
alert('called from AS3');
// OR
nonExistent.madeUp();
}
Hello! Hopefully this added info will help keep this question alive :). I am using Actionscript 2 with Flash Multimedia Professional 8, and I am also getting this crash error with Firefox. I am importing flash.external.ExternalInterface, and the two functions I use are
//confirmation dialog
function confirmationDialog(mesg:String) {
return ExternalInterface.call("confirm", mesg);
}
//alert dialog
function alertDialog(mesg) {
return ExternalInterface.call("alert", mesg);
}
My code calling each function always looks something like this..
//if i need an alert to continue on the page
if (abc == ''){
alertDialog("Message Here");
return;
}
//if the user has the option of continuing or returning
if (abc2 == 'hello') {
var response = confirmationDialog("New Message Here");
if (colorChoise == false){
return;
}else{
//do nothing and continue forward
}
}
I'm on an HP desktop with Windows 7, Firefox 5.0, IE9, and Chrome 12.0.742.122. Either al开发者_如何学Goert call will randomly cause Firefox to freeze...it actually usually happens in bunches, where it'll freeze for a few times continuously (obviously restarting Firefox each time)..and then stop for a few hours and be alright. It has yet to crash IE9 or Chrome, though I haven't tested it as extensively with Chrome. Using the Firefox console doesn't help since Firefox just crashes all together. If anyone could shed some light on that, that'd be great!
I just encountered this error, and it seems that it is a bug in Firefox itself. It probably will be remedied with the next patch release. Consult Firefox Bug 648935.
I'd follow Martin's advice above, also in IE9 you can use F12 to bring up the "Developer Toolbox" to access the console much like Firebug.
Have you tried it in other browser with debugging capabilities like chrome or safari? That might shed some light on your problem, if they don't crash like firefox.
You could also try another version of firefox, maybe an older one installed on virtual machine maybe... maybe that won't crash.
You could also try another version of flash and see if that fixes it.
In general, testing you code on multiple browsers and on multiple versions of flash will benefit both you and the users of your website.
Having many browsers in many versions with many plugin versions installed in a bunch of small virtual machines that you can pull out to test-run your code once you like it, or in situations like this, is good practice :)
If none of this helps, forget about stepping through, just console.log the shit out of everything that might happen, and see what comes out last before the browser crashes - it should at least give you a hint as to where it goes wrong, if not, what actually makes it crash ;)
精彩评论