A method assigned to a variable can be invoked via that variable using the standard parentheses operator, ( ).
package{
import flash.display.Sprite;
public class Main extends Sprite{
public function Main(){
var consume = eat;
consume();
}
public function eat () {
trace("eat");
}
}
}
Related examples in the same category