Class call a method
Hi,
If you have numerous methods in a class, can you just call them like so:
// in the .fla file
var john:Person = new Person(63,150); // creates a new person named john 63" and 150lbs.
john.weight(180); // changes johns weight to 180lbs.
// in the .as file
package {
import flash.display.MovieClip;
public class Person extends MovieClip {
public var _perHeight:Number;
public var _weight:Number;
public function Person(perHeight:Number, weight:Number) {
_perHeight=perHeight;
_weight=weight;
this.perHeight=_perHeight;
this.weight=_weight;
}
public function changeWeight(newWeight) {
this.weight=newWeight;
}
}
}
I must be calling the method completely wrong? I get this error:
1061: Call to a possibly undefined method weight through a reference with static type Person.