• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 12. Functions > What Is a Function?

What Is a Function?

Think of functions as the organizers of Macromedia Flash MX. They group related ActionScript statements to perform a specific task. Often you need to write code to perform certain tasks over and over again. Functions eliminate duplication of code because the code can remain in one place, and you can call on it wherever and whenever you wish. Functions are blocks of reusable code that can be passed certain parameters and will return a value. Following is an example of a function that returns the square of parameter z:

function sqr(z) {
     Return z * z;
}


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint