I make numerous ExternalInterface calls for JavaScript methods and have a helper function for this:
protected function JSCall( methodName:String, ...args ):void
{
try
{
ExternalInterface.call( methodName, args );
}
… etc …
}
However, this means that the JavaScript method will be passed only to one argument - an array of arguments - this means that I have to change the JavaScript to accommodate this, for example. instead:
function example(argument1, argument2)
{
}
As a result, I:
function example(args)
{
var argument1 = args[0];
var argument2 = args[1];
}
I would like the argument array to be passed to the method JSCall, so that each argument is passed individually for the call ExternalInterface, so that:
JSCall('example', ['one', 'two'])
works like:
ExternalInterface.call('example', 'one', 'two')
source
share