I have a calc function in java script that takes three integer parameters,
following is the AS3 code
import flash.external.ExternalInterface;
var para:Array = new Array();
send_btn.addEventListener(MouseEvent.CLICK, clickListener);
function clickListener(eventObj:Object ):void {
para.push(mean.text);
para.push(std.text);
para.push(points.text);
trace("click > " + para);
ExternalInterface.call("calc",para );
}
is this the right way of doing it and how do i get back 3 arguments back from the javascript and display them in flash?
In addition, you need to register your AS function so that it's available to the container:
ExternalInterface.addCallback("callFlash", myASFunction);
Then, from your container (JS), you call the AS function and pass whatever parameters you want to it.
<script language="JavaScript">
flashObject.callFlash(param1, param2, param3);
</script>
...
<object id="flashObject"...>
...
<embed name="flashObject".../>
</object>
Lastly, in AS3, you write the function that will be executed when the container "calls back":
function myASFunction(param1:String,param2:String,param3:String):void {
trace("\n Received call from JS: " + param1 + param2 + param3);
}