Function Scope


The scope of a function is like the scope of a variable; it is directly available (called by name, instead of dot syntax mapping to the function) only in the following ways:

  • If the function is called on the same timeline the variable was created in.

  • If the function is called from a button where the function resides on the same timeline as the button that called it.

In previous versions of Flash, if none of these criteria were met, you had to use dot syntax to map to the function you created. Since Flash MX, you can use the _global identifier to create a function that is available throughout the entire Flash movie and all its timelines. (We will discuss the _global identifier later in this chapter.)

First, let's go over how to map to functions using dot syntax.




Macromedia Flash Professional 8 Unleashed
Macromedia Flash Professional 8 Unleashed
ISBN: 0672327619
EAN: 2147483647
Year: 2005
Pages: 319

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net