Bound Methods, which is treated as a value : function variable « Function « Flash / Flex / ActionScript






Bound Methods, which is treated as a value

 

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

    var consume = eat;

    }
    public function eat (calories) {
      trace("eat");
    }
  }
}

        








Related examples in the same category

1.Function type variable
2.Referencing Functions
3.Creating Anonymous Functions
4.A method assigned to a variable can be invoked via that variable using the standard parentheses operator, ( ).