Flash与JS之间相互调用以及参数传递
[AS3]ExternalInterface.call传多个参数的写法代码示例
import flash.text.TextField; var param1:uint = 20; var param2:uint =17; var result:uint = ExternalInterface.call("addNumbers", param1, param2); function callMe(str:String):void{ //outtext.text=str; var outtext:TextField=new TextField(); outtext.text=str; addChild(outtext); trace(outtext); //return "busy signal"; } ExternalInterface.addCallback("myFunction", callMe);
html中JS中的写法
自动发布后 在HTML文件里添加下面代码: function addNumbers(num1, num2) { document.write(num1+num2); return (num1 + num2); } document.getElementById("ExternalInterface").myFunction("successfull");