I am writing a program where I have used multiple movieclips (boxes) that are put into a grid using a nested for loop.
Each movieclip is in an array and I want to give them names (box1, box2, e.t.c) but when I try to trace() them i get this in the output: “[object gridBox]”.
Here’s my code:
var gridBoxArray:Array = new Array()
var rows:int = 6
var columns:int = 6
for (var a = 0; a < rows; a++){
for (var b = 0; b < columns; b++){
var newGridBox:MovieClip = new gridBox()
newGridBox.x = a * (newGridBox.width)
newGridBox.y = b * (newGridBox.height)
addChild(newGridBox)
gridBoxArray.push(newGridBox)
newGridBox.name = "box" + gridBoxArray.index
}
}
trace(gridBoxArray[0])
Can anyone help?
Thanks,
ccg1993