Chapter 2. Functions

When programming, you might find yourself using the same chunks of code repeatedly— either by copying and pasting them or by rewriting the same lines of ActionScript. There is a way to write ActionScript just once and reuse it any time with a single action. You do this with functions, and the action by which you execute a function is a call or a function call. Functions are real time-savers—during both development and code maintenance—because they reduce the amount of code you need to write or modify. Think of a function as a mini-program that serves a specific purpose within another application. You can use it to perform a set of specific actions, you can feed it information and output a result—or you can do both. Functions ...

Get Macromedia® Flash® 8 ActionScript: Training from the Source 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.