Creating an Array of Objects in Actionscript

snipped by pmolaro

This is pretty basic stuff, but I use it all the time. This is an example of how to load an Array of Objects; the benefit is that when you want to reference them, you can just call MyArray.ObjectName

/* ********************************************************************
    This is an example of how to load an Array of Objects; the benefit
    is that when you want to reference them, you can just call
    MyArray.ObjectName
******************************************************************** */
 
var MyArray:Array = new Array();
 
  MyArray.push (
	{FirstName:"John"},
	{LastName:"Smith},
	{DateLoaded: new Date().date.toString();}
  );
 
trace('My name is ' + MyArray.FirstName + ' ' + MyArray.LastName);
 
trace('nI assigned this on ' + MyArray. DateLoaded);