Define a class : Class : Class Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Class » Class »

 

Define a class


 

package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){
        var crTest:Car = new Car();
        trace(crTest.make);  // Displays: undefined
        crTest.make = "Old";
        trace(crTest.make);  // Displays: Olds


    }
  }
}
class Car {
  private var _sMake:String;

  public function get make():String {
    return _sMake;
  }

  public function set make(sMake:String):void {
    _sMake = sMake;
  }
}

        



Leave a Comment / Note


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


Flash / Flex / ActionScript examples

 Navioo Class
» Class