views:

1706

answers:

1

I have a Flash/AS3 project I am trying to add a call back on, I added the call back like so:

ExternalInterface.addCallback('force_refresh',force_refresh);

and I am calling in from JS like this:

function thisMovie(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return window[movieName];
    } else {
        return document[movieName];
    }
}
function forceRefresh() {
    thisMovie("monthly_goals").force_refresh();
}

I made sure I am importing the ExternalInterface class, I set allowScriptAccess to "always", I alerted thisMovie("monthly_goals") and confirmed that JS sees the object.

Not sure why else it would not be working? any ideas?

Thanks.

A: 

So my call back method was expecting a parameter and I was not passing one when calling it from JS, so I guess it was just failing silently.

John Isaacks
If you use the Debug flash player, it should *not* fail silently, but give you a modal dialog with the stack trace and exception text.
Not Sure
Thanks for your comment, in order to test this though I would have to have it embedded in the web page in order for JS to call the method, I am not sure if there is a way to run debugger that way?
John Isaacks
If you have the debugger version of flash it will alert errors when embedded in a web page.
Bryan Grezeszak