1 Reply Latest reply on Feb 25, 2008 3:38 PM by Rothrock

    Overriding Methods and super.method()

    Rothrock Level 5
      I've got some custom classes that extend and extension of the MovieClip. At the end of the movieclip timeline I want the end users to be able to simply call myMethod to signal they are at the end of the timeline. Certain classes will need to do something things and others yet others, but they will all also need to do a few things in common.

      I was hoping to define the "in common" things in the super class and then overide the method for the extensions. So in my example I was hoping that an instance of Class B would do what it needed to do and then call the super function. However Class C has nothing specific itself to do and since the method wasn't overriden the same myMethod() on the timeline would invoke the super classes method.

      So the case of Class C works. But in the case of Class B. I get the trace that the Class B method has been called, but I don't get a message that Class A was called. Is there a way to make this idea work? Is it a good idea? What am I missing?
        • 1. Re: Overriding Methods and super.method()
          Rothrock Level 5
          Okay I've worked it out. The trick comes in with how you call myMethod(). On the timeline I have to be sure and use a qualified reference. So, this is on the of an instance of B, if I use


          I only get the myMethod() from class B, but if I do:


          I get B and A. But oddly enough if I say invoke myMethod from the constructor of B, I get both trace statements -- regardless of whether or not I use a qualified reference! Now that is strange.