Overriding a setter from subclass

nvm! I’m loopy today. Problem resolved.

**super.zValue(n) should be super.zValue = n … wowy

Nothing to see here folks, just keep moving on :)**

=====

Hello all,

I’m having some difficulties in working with the as3 way of overriding methods… specifically setters. I’m a recent convert from working with as2 for a few years, so some of these quirks are beyond me right now.

Here are my two classes:

class tempBase in package core


package core 
{
    import flash.display.MovieClip;
    public class tempBase extends MovieClip
    {
        public function tempBase() {}
        
        public function baseFunction():void {
            var i = 0;
            ++i;
        }    
        public function set zValue( n:Number ):void {
            var z = n;
        }
    }
}

class newClass in package forms


package forms 
{
    import core.tempBase;

    public class newClass extends tempBase
    {
        public function newClass() {}
        
        public override function baseFunction():void {
            super.baseFunction();
            var z = 5;
        }
        
        public override function set zValue( n:Number ):void {
            super.zValue( n );
        }
    }
}

I do not have any errors for the override of baseFunction, but on compile I get the error 1061: Call to a possibly undefined method zValue through a reference with static type core:tempBase.

In as2, this would have been perfectly acceptable (even without the override function), and was incredibly useful in creating my class structures. What would be the proper fix or way to go about doing this for AS3?

Thanks in advance for any help you can provide :slight_smile: