开发者

Linking flash to OOP javascript using ExternalInterface?

开发者 https://www.devze.com 2022-12-13 04:01 出处:网络
I\'m looking to call a flash method from a method in javascript and recieve a result: Example: Flash - Extern开发者_开发百科alInterface.addCallback(\"getProgress\", getProgress) // Javascript to fl

I'm looking to call a flash method from a method in javascript and recieve a result:

Example:

Flash -

Extern开发者_开发百科alInterface.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???


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消