Referencing multiple classes in a for loop

Hi All,

I have an issue here that has me stumped. I’m trying to reference multiple classes in my for loop:


    for(var a:Number = 0; a < 5; a++){
    var img[a]:Img[a] = new Img[a]();
    addChild(img[a])
}

I have 5 images I’m trying to add to the stage, but when I run the above code, I get the following error:

1086: Syntax error: expecting semicolon before leftbracket.

However, when I run the following trace:

trace("img" + [a])

I see the desired result. I’ve tried multiple combinations but nothing has worked for me yet. Any ideas?