vendredi 13 janvier 2017

Is there a method equivalent of removeCallback for Flash ExternalInterface?

I have an Flash SWF application in the browser and I'm using ExternalInterface to communicate to JavaScript document.

In the Flash ExternalInterface API there is an addCallback method. It adds a function on the browser SWF object. When you call it it creates a method on the SWF object in the browser that JS can call:

AS: 
public function myEventListener(event):void {};
ExternalInterface.addCallback("myFunction", myEventListener);

JS: 
// returns "function"
console.log(typeof swfObject.getObjectById('myApp').myFunction);

But I do not see any existing removeCallback method. What would be the equivalent to removeCallback?

Here is what I have so far:

var application = this[objectId]; // gets the Flash object 
application[callbackName] = null;
delete application[callbackName];

Does this look correct?

Aucun commentaire:

Enregistrer un commentaire