A simple example of a method declaration using parameters : Method « Class « Flash / Flex / ActionScript






A simple example of a method declaration using parameters

 

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

        var averageValue:Number = average(5, 11);

    }
    private function average(a:Number, b:Number):Number {
        return (a + b)/2;
    }
  }
}

        








Related examples in the same category

1.Defining Methods for a Class
2.Adding Static Methods to a Class
3.Create a method and then call it by name
4.Change member variable value in member method