1 Reply Latest reply on Nov 12, 2009 8:57 PM by kglad

    objects, classes, and functions?

    shintashi Level 1

      I have a number of objects created using the myObject = new Object(); syntax.

      several of the objects have entire lists of similar properties.

      For example;

      myBox.cmwidth = 10; myCircle.cmwidth = 10; myTriangle.cmwidth = 10;

      myBox.color = "blue"; myCircle.color = "blue"; myTriangle.color = "blue";


      is there a way to create a class, function, or object parent/child that represents color = blue and cmwidth = 10?


      I thought to use A extends B, but that appears to require both parent and child to be classes. Are objects and classes compatible?

        • 1. Re: objects, classes, and functions?
          kglad Adobe Community Professional & MVP

          you could create a myShape class that extends the object class and all class instances have cmwidth property = 10 and have a color property = "blue".  then create a myBox class that extends the myShape class and a myCircle class that extends the myShape class etc.

          1 person found this helpful