class array in javascript

hi…

i am new in javascript.

for example, i have a class like this

class FooClass {

   public var a: int;
   public var b: int;

}

i want to set foo array.
and of course i want set some variables in the array

var foo: FooClass [ ];

function Start()
{
 foo : new FooClass [15];
 foo[1].a  = 10; // nullexception error in here!!!

}

bu i cant… i get a error in “foo[1].a” statement

thank you for your ideas…

Entries in the array are null until initialized.

 var foo = new FooClass [15];
 foo[1] = new FooClass();
 foo[1].a  = 10;

Alternately, you can make a constructor for the class, so you can initialize variables when declaring the class.

–Eric

Thanks alot Eric!