Question

I want to pass Value from Constructor in my Main Class to another Class.

Main Class:

public function Main() {

        Snap.locationX = 350;
    }

Another Class:

   public function get locationX():Number{
      return _value;
   }


   public function set locationX(x:Number):void{
      _value = x;   
   }

It returns 1061: Call to a possibly undefined method locationX through a reference with static type Class.

What am I doing wrong?

Was it helpful?

Solution

The setter and getter methods you have defined above are INSTANCE methods. It seems like you are calling Snap.locationX on the Snap class itself and not on an instance of the Snap class.

try (under Main()):

var snapObj:Snap = new Snap();
snapObj.locationX = ...
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top