Array decleration problem

hi folks… i got problems with the following code… i’m used to code c++ so i’m quite unused to AS… is it possible to declare arrays like this:

aBgPic[11] = new Array;
 for(x=0; x<=11; x++)
 {
     aBgPic[x] = "bg_pics/bg_pic" + x + ".jpg";
 }

this code doesnt work… could someone pls tell me an alternativ… or how to do it right…

thx in advance

yours


aBgPic = new Array(11);
for(x=0; x<11; x++){
aBgPic[x] = "bg_pics/bg_pic" + x + ".jpg";
}

Specifying the length of the array in the constructor arguments (Array(11)) is possible, but not required, because arrays in AS are dynamic unlike arrays in C++. You can add elements and remove elements at will. Therefore, if you just create an empty array and use the for loop to write to elements 0 to 10, the array will extend to fit the 11 elements.

aBgPic = ;
for (x=0; x<=11; x++) {
aBgPic = “bg_pics/bg_pic”+x+“.jpg”;
}

or if you are deliberately making index11 of aBgPic an array
aBgPic = ;
aBgPic[11] = ;
for (x=0; x<=11; x++) {
aBgPic[11] = “bg_pics/bg_pic”+x+“.jpg”;
}

thx for the replies folks…