Reputation: 22901
I'm looking to call a flash method from a method in javascript and recieve a result:
Example:
Flash -
ExternalInterface.addCallback("getProgress", getProgress) // Javascript to flash
public function getProgress():void {
ExternalInterface.call("getProgress", progress); // Send progress back to javascript from flash
}
Javascript -
Object.prototype = {
...
getProgress : function() {
$("#movie").getProgress();
return progress;
}
...
}
Anyone have any idea how to hook all this up???
Upvotes: 0
Views: 140
Reputation: 59451
Are you trying to pass the value of progress
from flash to javascript or javascript to flash? From the wording of the question it seems that you want to call a flash method from javascript and receive a return value. But then why are you calling ExternalInterface.call
from flash's getProgress
method and returning progress
from the javascript method?
change the flash part to:
ExternalInterface.addCallback("getProgress", getProgress)
public function getProgress():void
{
return progress;
}
And call
alert(window["moviename"].getProgress()); //IE
alert(document["moviename"].getProgress()); //Firefox
Checkout ExternalInterface
example in livedocs.
Upvotes: 1