I have an array of arrays (a multi-dimensional array so to speak, doors in this example), in which wait and point are undefined.
var wait;
var point;
var doors = [
[wait, doorWrap, 'regY', point, 10, 'bounceOut', 150, 5, 'bounceIn']
// ,[etc.]
];
I want to loop the doors array and for every iteration, execute the key() function, with the doors entries as arguments.
multiKey(doors, 500, 600);
function multiKey (keys, point, wait) {
for (var i = 0; i < keys.length; i++) {
wait *= i;
key.apply(this, keys[i]);
}
}
Having passed 500 and 600 into the multiKey() function, I expected that point and wait would be defined before the key() function would run -- but heck, point and wait turn out to be undefined.
What is wrong? How could I go about solving this?
Sorry for the title too. I hope the question is clear enough though, because I had a hard time putting my problem into words! Thanks.