0

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?

Amarghosh
  • 58,710
  • 11
  • 92
  • 121
Bachalo
  • 6,965
  • 27
  • 95
  • 189

2 Answers2

1
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
  • 58,710
  • 11
  • 92
  • 121
0

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+"'  )");
Sreehari
  • 5,621
  • 2
  • 25
  • 59
Bachalo
  • 6,965
  • 27
  • 95
  • 189