Here’s an array:
var array = new Array();
array[0] = "sound1.mp3"
array[1] = "sound2.mp3"
array[2] = "sound3.mp3"
In a function that I’ve written, I need to get the string’s order number.
Here’s what I’ve got so far:
function registerSound(array, i) {
var arrno = ???;
var arrurl = array[i];
soundManager.createSound({ id: 'sound' + arrno, url: arrurl });
}
function processArray(array) {;
for(i=1; i<array.length; i++) {
registerSound(array, i);
}
}
The arrno variable should have the order number of "sound2.mp3" (in this case 1). It needs to be set up so that, when the for statement turns to the next string in the array, the arrno variable will contain the order number of "sound3.mp3" (2).
Thanks very much in advance!
Also, declare your variables and start your loop from
0: