5

Functions and Arrays

This chapter looks at our last two corners of the fundamentals of ActionScript, arrays and functions. Both concepts once understood, will revolutionize the way you build applications.

Functions

Functions are a way of packaging a block of code that performs a particular task so that it can be used by a shorthand call, eliminating the need to retype the code. Functions encapsulate code that is used repeatedly. They are invoked by “calling” the function’s name. In addition to reducing the amount of typing a programmer must do, functions generally make code more readable by replacing large blocks of complicated instructions with a simple, easy-to-digest function name. A well-written function can be used by other movies. ActionScript ...

Get Understanding Flash MX 2004 ActionScript 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.