0

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???

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for responding. I managed to solve this problem exactly as you suggested. I didn't realize the flash function called from addCallback could return a value!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.