class Car {
public var speed:Number;
public var direction:String;
public var onSpeedChange:Function;
public var onDirectionChange:Function;
public function Car(speed,direction) {
this.speed = speed;
this.direction = direction;
}
public function increaseSpeed() {
this.speed += 10;
this.onSpeedChange();
}
public function setDirection(direction) {
this.direction = direction;
this.onDirectionChange();
}
}
|