Follow Flex After Dark on Twitter

ActionScript Functions

In ActionScript, a Function is first-class object. The Function class is in the "top-level" package.

You can pass a function as an argument to another function, and then call the passed function.

   public function callOtherFunction( otherFunction:Function ):void
   {
      // call the passed in function
      otherFunction();
      // or
      otherFunction.call();
   }

Get and Set Functions

Learn more about Get and Set Functions (also known as accessors)...

Functions as Arguments...

The nearly omni-present addEventListener()...

Closures

A closure is an object that represents a snapshot of a function with its lexical context (variable's values, objects in the scope). A function closure can be passed as an argument and executed without being a part of any object.

   TODO...

Functions vs. Methods

Methods of a class are slightly different than Function objects. Unlike an ordinary function object, a method is tightly linked to its associated class object. Therefore, a method or property has a definition that is shared among all instances of the same class. Methods can be extracted from an instance and treated as "bound" methods (retaining the link to the original instance). For a bound method, the this keyword points to the original object that implemented the method. For a function, this points to the associated object at the time the function is invoked.

Related Links:

Related Docs
Recent Docs
Random Docs
  • Flex Dialogs Overview of Dialogs in Flex and usage examples.
  • Flex HTML Template Flex projects in Flex Builder make use of an HTML Template file for launching.
  • Flex Forms Forms in Flex can be used for collecting, and validating, user input.
  • ActionScript Responder The IResponder interface is used for handling asynchronous call results.
  • MXML Language Overview of the MXML programming language used by Flex.