Don't understand inability to access class property

This is making me tear my hair out.

I have a class ControlPoint. It has two properties, _anchorEntering and _anchorExiting, which I access from another class, AnchorData, using a setter:

public class ControlPoint {
     private var _anchorEntering:Point;
     private var _anchorExiting:Point;
    // etc.

     public function ControlPoint(x:Number, y:Number):void {
            _anchorEntering = new Point(x, y);
            _anchorExiting = new Point(x, y);
     }
    public function get anchorEntering():Point {
            return _anchorEntering;
    }
    public function set anchorEntering(pt:Point):void {
            _anchorEntering = pt;
    }
    public function get anchorExiting():Point {
            return _anchorExiting;
    }
    public function set anchorExiting(pt:Point):void {
            _anchorExiting = pt;
    }
}
public class AnchorData {
 
     public function AnchorData(cp1:ControlPoint, cp2:ControlPoint):void {

     }
     public function setAnchors(cp1:ControlPoint, cp2:ControlPoint):void {
          // do some computations to get some points pt1, pt2, pt3, pt4 to plug in...
          cp1.anchorEntering = new Point(pt1.x, pt1.y);
          cp1.anchorExiting =  new Point(pt2.x, p2.y);
          cp2.anchorEntering = new Point(pt3.x, pt3.y);
          cp2.anchorExiting =  new Point(pt4.x, p4.y);
     }
}

All of this works just fine.

BUT… I then decided to add two new properties to ControlPoint, _ctrlEntering and _ctrlExiting:

public class ControlPoint {
     private var _anchorEntering:Point;
     private var _anchorExiting:Point;
     private var _ctrlEntering:Point;    // <-- added these properties
     private var _ctrlExiting:Point;
    // etc.

     public function ControlPoint(x:Number, y:Number):void {
            _anchorEntering = new Point(x, y);
            _anchorExiting = new Point(x, y);
            _ctrlEntering = new Point(x, y);              // new properties
            _ctrlExiting = new Point(x, y);
     }
    public function get anchorEntering():Point {
            return _anchorEntering;
    }
    public function set anchorEntering(pt:Point):void {
            _anchorEntering = pt;
    }
    public function get anchorExiting():Point {
            return _anchorExiting;
    }
    public function set anchorExiting(pt:Point):void {
            _anchorExiting = pt;
    }
    public function get ctrlEntering():Point {          // added getter/setters
            return _ctrlEntering;
    }
    public function set ctrlEntering(pt:Point):void {
            _ctrlEntering = pt;
    }
    public function get ctrlExiting():Point {
            return _ctrlExiting;
    }
    public function set ctrlExiting(pt:Point):void {
            _ctrlExiting = pt;
    }
}
public class AnchorData {
 
     public function AnchorData(cp1:ControlPoint, cp2:ControlPoint):void {

     }
     public function setAnchors(cp1:ControlPoint, cp2:ControlPoint):void {
          // do some computations to get some points pt1, pt2, pt3, pt4 to plug in...
          cp1.anchorEntering = new Point(pt1.x, pt1.y);
          cp1.anchorExiting =  new Point(pt2.x, p2.y);
          cp2.anchorEntering = new Point(pt3.x, pt3.y);
          cp2.anchorExiting =  new Point(pt4.x, p4.y);
          cp1.ctrlEntering = new Point(100, 200);             // this throws 1119 error!!
     }
}

Attempts to access these NEW properties results in AnchorData.as(74): 1119: Access of possibly undefined property ctrlEntering through a reference with static type ControlPoint.

WHY??!! I created ctrlEntering in EXACTLY the same way, accessed it in EXACTLY the same fashion from EXACTLY the same place on an instance of ControlPoint that is quite happy to let me access the other proprties.

What’s going on??

Nevermind. Figured it out. I had a copy of the class file in two places and was editing the wrong one. Duh.

3 Likes