Adding Static Properties to a Class: static publicPrivateModifier var propertyName:Datatype; : Properties « Class « Flash / Flex / ActionScript






Adding Static Properties to a Class: static publicPrivateModifier var propertyName:Datatype;

 


package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){
       trace(Car.EXTERIOR_COLORS);

    }
  }
}
class Car{

   static public var EXTERIOR_COLORS:Array = ["red", "silver", "gold", "white", "blue"];
}

        








Related examples in the same category

1.Build a returning value from get property method
2.Use get and set for properties
3.Use get and set to define the readable and writable properties
4.Another option is to use implicit getters and setters.