Finally, access to "super" getters and setters

While looking through the Flex 2.0 help files, I discovered a great little section on inheritance. Near the bottom, I found a section that covers overriding getters and setters. It included the following code:

package
{
    import flash.display.MovieClip;
    public class OverrideExample extends MovieClip
    {
        public function OverrideExample()
        {
            trace(currentLabel)
        }

        override public function get currentLabel():String
        {
            var str:String = "Override: ";
            str += super.currentLabel;
            return str;
        }
    }
}

You’ll notice that the currentLabel getter calls super.currentLabel. That never worked in AS2. It makes me happy. 🙂

About Josh Tynjala

Josh Tynjala is a frontend developer, open source contributor, bowler hat enthusiast, and karaoke addict. You might be familiar with his project, Feathers UI, an open source user interface library for Starling Framework that is included in the Adobe Gaming SDK.