开发者

ExternalInterface-passing dynamic arguments to Javascript function

开发者 https://www.devze.com 2022-12-12 15:22 出处:网络
I\'m having a problem passing dynamic variables to a Javascript function using ExternalInterface. The variables don\'t seem to be resolved correctly

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

The variables don't seem to be resolved correctly

开发者_JAVA技巧//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?


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);


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+"'  )");
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号