1 Reply Latest reply on Nov 8, 2006 2:28 PM by l810c

    User Data Type

    scsherwood
      Visual Basic has the capability to define a User Data Type as follows:

      Type myDataType
      foo as Boolean
      bar as Integer
      anArray(1 to 10) as Integer
      end Type

      Then you can create a new array of this this type as follows:

      myNewVariable(1 to 5) as myDataType

      and access the first member of the array and its submembers as follows:

      myNewVariable(1).foo = True
      myNewVariable(1).bar = 23
      myNewVariable(1).anArray(8) = 41

      All of the submembers are strictly typed.

      I would like to do the same thing in Actionscript 2.0. I assume I would do this by creating a

      class myDataType extends Array {

      function myDataType(){
      }

      }

      but I can't figure out how to create and strictly type the submembers of myDataType, so that I can access them from an instance of an array of myDataType in a fla file.

      var myNewVariable:myDataType = new myDataType(5);
      myNewVariable(1).foo = True;
      myNewVariable(1).bar = 23;
      myNewVariable(1).anArray = new Array(10);

      Is there a way to do what I want?

      Thanks in advance.