What type of Array should I use?

I need a javascript 2D array to store information about GUI boxes to be rendered, for example.

alt text

The “boxTitle” along with a few other columns need to be strings, the xPosition, yPosition etc. Determine the position of each box and therefor need to be ints.

My question, how would I go about declaring this, what type of array should I use, and could you give me an example of how I would then read from the array?

I have spent a whole day trying to wrap my head around something that should be really easy.

Create a custom class with the needed attributes and create an array of that class.


public class Box {

public var boxID : int;
public var boxTitle : String;
public var xPosition : int;
public var yPosition: int;
public var xSize : int;
public var ySize : int;

    function Box() {
    	boxID = 0;
    	boxTitle = null;
    	xPosition = 0;
    	yPosition = 0;
    	xSize = 0;
    	ySize = 0;

    function Box(ID : int, title : String, xP : int, yP : int, xS : int, yS : int) {
    	boxID = ID;
    	boxTitle = title;
    	xPosition = xP;
     	yPosition = yP;
    	xSize = xS;
    	ySize = yS;

Create an array like this:

private var testArr : Box[] = new Box[10];   //use whatever number of entries you need in that array