Add method to class : Member method « Class « Flash / Flex / ActionScript






Add method to class

 

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

      var cla:MyClass = new MyClass("S");
      
      cla.aMethod(  );
    }
  }
}
internal class MyClass {
    internal var varName;
    private var currentVar = 1000;

    public function MyClass (name) {
      this.varName = name;
    }

    function aMethod (  ) {
      trace(" in aMethod");
    }
  }

        








Related examples in the same category

1.Update data in a member method
2.Access Control Modifiers for Instance Methods
3.Method Parameters and Arguments
4.Method Returning Values
5.Using the returning value from method to do the calculation
6.Using Methods to Examine and Modify an Object's State