2 Replies Latest reply on Sep 28, 2006 4:26 PM by TimSymons

    Is it possible for a class to extend more than one class?

    disco-logic
      As the title states I want to know if its possible for a class to inherit traits from more than one class?

      I suppose you could just duplicate the function of the second sub class you want in the new one but is it officially supported?
        • 1. Re: Is it possible for a class to extend more than one class?
          Level 7
          disco-logic,

          > As the title states I want to know if its possible for
          > a class to inherit traits from more than one class?

          You betcha. The trick is to do it sequentially.

          > I suppose you could just duplicate the function of
          > the second sub class you want in the new one but
          > is it officially supported?

          Absolutely. Take a look at any of the Component classes in the
          Components Language Reference. For example, picking randomly here ... take
          the ComboBox class. All ComboBox Component instances are instances of the
          ComboBox class, which inherits from ComboBase, which inherits from
          UIComponent, then UIObject, and finally MovieClip.

          That means every ComboBox instance *is a* movie clip, *is a* UIObject
          (just a more specific kind), *is a* UIComponent, and so on.


          David Stiller
          Adobe Community Expert
          Dev blog, http://www.quip.net/blog/
          "Luck is the residue of good design."


          • 2. Re: Is it possible for a class to extend more than one class?
            TimSymons Level 1
            I agree with David about using this method, however, technically, ActionScript does not support mulitple inheritance like C++ does. You can only have 1 base class that you inherit from.

            Tim