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.
keyfunction anywhere. So that's probably why it'sundefined... And that's the only real problem that you say you are having. It's not clear what you are after here.key()function here because I didn't think it was relevant. But it's in my code.waitin yourmultiKey()signature and thewaitin yourdoorsArrays are different values.keyisundefined, and you didn't think that included how to you definekeyis relevant? What is the code you have, and what exactly is wrong with it?waitandpointareundefinedinside thekeyfunction. Seems that there's an assumtion that all thewaitidentifiers will automatically resolve to the same memory.