3. Working with Functions

When you work with ActionScript, there are sequences of code that you may want to execute multiple times. To do this, you need a way to group the code into a logical block and give it a name that will tell the Flash runtime to execute the code.

Functions are the way to do exactly that. Using functions, you can group commonly used commands for repetitive use throughout your application. In this chapter, you’ll learn the commands and syntax to create a basic function, and then learn how you can extend the use of your functions to send and receive data in and out of them.

Fundamentals of Functions

To get started with functions, let’s look at the following example.

1. Create a new ActionScript 3.0 Flash file and enter the ...

Get Fundamentals of ActionScript 3.0: Develop and Design 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.