ABSTRACT

This chapter looks at our last two corners of the fundamentals of ActionScript, arrays and func-

tions. 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 has many functions built into

it, like trace( ). These are special types of functions; another built-in function that you will often

use is the gotoAndStop( ) function. A built-in function is a reusable bit of code that comes built

into ActionScript.