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.
To get started with functions, let’s look at the following example.
1. Create a new ActionScript 3.0 Flash file and enter the ...