views:

232

answers:

2

I'm having a problem passing dynamic variables to a Javascript function using ExternalInterface.

The variables don't seem to be resolved correctly

//CODE START
var customInfo :String='some custom info'

ExternalInterface.call("funcName", 'arg1Name', ' "+customInfo+" ')

//CODE END

In Javascript, I get 'customInfo' literally, it isn't being resolved.

Can anyone help?

+1  A: 
var customInfo:String = 'some custom info';

ExternalInterface.call("funcName", 'arg1Name ' + customInfo + ' ');

//or if you want to pass them as two arguments:
ExternalInterface.call("funcName", 'arg1Name', customInfo);
Amarghosh
A: 

ok this is what I've done since I need to pass several name value pairs thru the ExternalInterface call, and the values need to be dynamic

dynamicValue1:String='some stuff'

dynamicValue2:String='some more stuff'

ExternalInterface.call("funcName( 'firstVarName', '"+dynamicValue1+"', '2ndvarname', '"+ dynamicValue2+"' )");

eco_bach