In c# I can do this:
public class Widget{
public int value1;
public int value2;
}
and elsewhere define a list of Widgets:
pulbic List<Widget> widgets = new List<Widget>();
Is it possible to make a list of Widgets in actionscript or am I stuck with jamming all the widgets into an array collection and casting each item when I use it?
You are looking for the Vector
class:
public var widgets:Vector.<Widget> = new Vector.<Widget>();
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/Vector.html
update In case you need a ListCollectionView
, respectively an ICollectionView
and/or IList
, check out David Beale's VectorCollection
.