3 Replies Latest reply on Jul 5, 2007 12:16 PM by ntsiii

    Object Lists

      I am new to AS3 and Flex, so this may be a very easy question.

      Is there any way of storing a list of objects using ActionScript?

      public class Person
      private var _name:String;
      privare var _age:int

      public function Person(name:string,age:int)
      _name = name;
      _age = age;
      public function get Name():String
      return _name;
      //... other methods and properties

      I want to create multiple instances of this class and store them in a list or an array, something like;
      psudo code
      List.add(new Person("fred",25);
      List.add(new Person("sue",22);
      List.add(new Person("joe",22);

      Then be able to access Person(List.item(1)).Name, which would return "sue"

      Thanks in advance...