# ActionScript-javascript communication

**URL:** <https://forum.kirupa.com/t/actionscript-javascript-communication/244924>\
**Category:** flash\
**Created:** [November 23, 2007, 4:10pm UTC](https://forum.kirupa.com/t/actionscript-javascript-communication/244924 "2007-11-23T16:10:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mfsiddiq](https://avatars.discourse-cdn.com/v4/letter/m/ea5d25/32.png) [@mfsiddiq](https://forum.kirupa.com/u/mfsiddiq)\
**Post date:** [November 23, 2007, 4:10pm UTC](https://forum.kirupa.com/t/actionscript-javascript-communication/244924/1 "2007-11-23T16:10:45Z")

</div>

HI

```
I am facing some problem with my as-js communication.I am passing a String expression to a javascript function using ExternalInterface.call function upon mouse click.My string expression is as follows
                      str="x=callAS(id)"

```

Inside my js function i am just using eval(str).callAS(id) contains a call to actionscript function to retrive the value of x using id.I am able to make call to the actionscript by registering the function using ExternalInterface.addCallBack(“callActionScript”,ASFunction) but the transfer doesnt return to the js on return i.e the value of x is not getting populated with the retrieved value.My function in actionscript is like this  
public function ASFunction(id:String):Number  
{  
return 6;

}  
This 6 have to be returned to js thereby populating x=6;which is not happening.Any suggestions will be of great help

Cheers  
Mfsiddiq
