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

Chapter 9. Functions > Function Availability and Life Span

9.6. Function Availability and Life Span

Like variables, program functions do not live forever and are not directly accessible from everywhere in a movie. In order to invoke functions with confidence, we need to know how to access them from different areas of our movie, and we need to be sure that they exist before we call them. In ActionScript, calling a nonexistent function has no effect. The call fails silently and does not produce an error (in JavaScript, calling a nonexistent function generates an error). To test whether a function ran when you called it, add a trace( ) statement, such as the following, to the function:

trace("Function someName executed.");


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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