Getting value from flash to javascript?

Go To StackoverFlow.com

0

public  function getTextId():String
{
    return val;
}

ExternalInterface.addCallback("getId", getTextId);

I am getting the following error:

Access of undefined property getTextId. ExternalInterface.addCallback("getId", getTextId);

But I have getTextId defined and all the tutorials indicate this is the correct method to do it.

2012-04-04 06:11
by SamFisher83
The code above should work just fine - could you paste in / upload the entire Class Definition and HTML page so we can try it locally - JonnyReeves 2012-04-04 09:27


1

Is your call to ExternalInterface.addCallback() inside of a method, or are you calling it a the "class level" (for lack of a better term), as shown in your code snippet?

I just tried adding the callback outside of a method, it worked... not surprised but I rarely code that way. However, I added second method as a callback, and got the same error as you at compile time.

Strange that it works for one method but not the other (no matter what I seem to try).

Have you tried moving the addCallback line into a function or the constructor? This fixes the error for me.

2012-04-04 06:22
by Sunil D.
Ads