is supported in part by

March 21, 2007

Chapter 5, Paragraphs 1&2, Essential ActionScript 3.0

Here are the first 2 paragraphs of Chapter 5 of Essential ActionScript 3.0

5. Functions

A function, or more specifically a function closure, is a discrete set of instructions that carry out some task, independent of any class or object. Functions closures have the same basic syntax and usage as instance methods and static methods—they are defined with the function keyword, can define local variables, are invoked with the parentheses operator, and can optionally return a value. However, unlike instance methods (which are always associated with an object) and static methods (which are always associated with a class), function closures are created and used in standalone form, either as a subtask in a method, or a general utility available throughout a package or an entire program.

In the strict technical jargon of the ActionScript 3.0 specification, function closures and methods are both considered types of functions, where the term function refers generally to a callable object representing a set of instructions. Thus, a function closure is a function that is not associated with an object or a class, while a method is a function that is associated with an object (in the case of instance methods) or a class (in the case of static methods). However, in common discussion and most documentation, the term function closure is shortened to function. Unless you are reading the ActionScript 3.0 specification or a text that specifically states otherwise, you can safely assume that function means function closure. In the remainder of this book, the term function means function closure, except where stated otherwise.

Posted by moock at March 21, 2007 05:59 PM