Change member variable value in member method : Method : Class Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Class » Method »

 

Change member variable value in member method


 
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();
          }
          
     }

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo Class
» Method