Search code examples
flashactionscript-3callbackexternalinterface

ExternalInterface.addCallback not working?


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.


Solution

  • 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.