Javascript still recognize actionscript functions previously nulled with call ExternalInterface.addCallback

86 Views Asked by At

Is there any way to make javascript recognize that function registered at actionscript with ExternalInterface.addCallback was removed by calling it again and passing null to closure reference?

I have this code at actionscript:

ExternalInterface.addCallback(functionName, myFunction);

At javascript I try to find out type of function registered:

var flashContent = document.getElementById("flashContent");
console.log(typeof flashContent.functionName);

Which produce following ouput at console:

function

Then I remove callback at actionscript by calling:

 ExternalInterface.addCallback(functionName, null);

But calling previous javascript check again:

console.log(typeof flashContent.functionName);

Produces the same output again:

function

Note that if I call this check before creating callback ExternalInterface.addCallback function I get output:

undefined

1

There are 1 best solutions below

2
Matej Sabo On

I needed to call some functions in flash content. But some functions might become unavaiable depending on state of our flash content.

I made workaround: Created "check" function on flash that is always avaiable to js.

  • It accepts one parameter - function name.
  • And it returns true or false whether function with that name is currently avaiable.

Javascript can then easily know if any function on flash is avaiable just by calling this "check" function first and passing desired function's name.