I have created an array with fixed size of 5, but when I try to insert element into array, the element is inserted into 6th position. Can anyone tell me how to insert value from the first place of array?
PS:Since the elements are randomly inserted, so I couldn't do something like this:songTitles[5] = "Happy Birthday";
Some references are as follows:
myRes = new Array(5);
if(e.keyCode == 65){
myRes.push(word1.getLabel());
trace(myRes);
} else if (e.keyCode == 83) {
myRes.push(word2.getLabel());
trace(myRes);
} else if (e.keyCode == 68) {
myRes.push(word3.getLabel());
trace(myRes);
} else if (e.keyCode == 70) {
myRes.push(word4.getLabel());
trace(myRes);
} else if (e.keyCode == 71) {
myRes.push(word5.getLabel());
trace(myRes);
}
The Result I get:
,,,,,A ,,,,,A,S ,,,,,A,S,F