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

Using Functions

A function is a block of ActionScript code that can be reused anywhere in a SWF file. If you pass values as parameters to a function, the function will operate on those values. A function can also return values. Flash MX contains built-in functions that let you access certain information and perform certain tasks, such as getting the version number of Flash Player hosting the SWF file (getVersion()). Functions that belong to an object are called methods. Functions that don't belong to an object are called top-level functions and are found in the Functions category of the Actions panel.

Each function has its own characteristics, and some functions require you to pass certain values. If you pass more parameters than the function requires, the extra values are ignored. If you don't pass a required parameter, the empty parameters are assigned the undefined data type, which can cause errors when you export a script. To call a function, it must be in a frame that the playhead has reached.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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