简体   繁体   中英

I can send variables from flash to javascript, but unable to do the opposite

I have this in AS3

var myName:String = "David";
var result:Number = ExternalInterface.call("methodInJS", myName);
trace("Result from JS call is: "+result);

And in javascript

function methodInJS(name) {
alert("Hello to " + name);
 return 17;
}

This allows me to send to javascript. What is the method to do the opposite. I want to send to flash.

SOLUTION: Looks like the addCallback works.

Thanks

I think you need to create an asynchronous call handler in Flex and then call that from JavaScript. See the docs here http://livedocs.adobe.com/flex/3/html/help.html?content=passingarguments_4.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM