Adding Static Methods to a Class : Method « Class « Flash / Flex / ActionScript






Adding Static Methods to a Class

 

/*
static publicPrivateModifier function methodName([paramList]):datatype {
  // Method code goes here.
}
*/


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

    }
  }
}
class Car{

   static public function statcF(){
      trace("static");
   
   }
}

        








Related examples in the same category

1.Defining Methods for a Class
2.Create a method and then call it by name
3.A simple example of a method declaration using parameters
4.Change member variable value in member method