Saturday, July 26, 2008

Global Variables AS3

STEP 1. Make a class called "GlobalVarContainer.as":

package
{
public class GlobalVarContainer
{
public static var vars:Object = [];
}
}

STEP 2. Main timeline:
import GlobalVarContainer;
var currentNav:Number;
GlobalVarContainer.vars.currentNav=10;

STEP 3. Then from any clip (even loaded ones):
var currentNav2:Number=GlobalVarContainer.vars.currentNav;
trace(currentNav2);

No comments: