Flash Cookbook - Tricks - Global variables
Sometimes it's useful to use global variables. In AS3 it's quite easy: you create a class and add static variables to it.
package
{
public class Vars
{
public static var value:int = 0;
}
}
To reach it from anywhere import the class (import Vars;) if needed and done.
trace(Vars.value);
Vars.value= 10;
trace(Vars.value);
Output:
0
10
(reference tag: singleton)