Hello, everyone!
I’m facing a problem with passing variables from array to function.
Array example:
var Arr:Array= [[0, 1, 2, 3, false],[4, 5, 6, 7, true]];
Function example:
function passVar(var1:Number, var2:Number, var3:Number, var4:Number, var5:Boolean){
trace(var1+" "+var2+" "+var3+" "+var4+" "+var5)
}
if I do something like this:
passVar(Arr[0])
i get 0,1,2,3,false undefined undefined undefined undefined in output, and I’m trying to figure out, how to properly pass variables from the array.
Using this:
passVar(Arr[0][0], Arr[0][1], Arr[0][2], Arr[0][3], Arr[0][4])
works, but is there any shorter ways like passing the whole array of variables?
Any help appreciated.
Thanks.