/** * Copyright (c) 2006 Peter Goodman * Licensed under the MIT License: * http://www.opensource.org/licenses/mit-license.php */ //-------------------------------------------- // A singleton class to deal with the creation // and use of global variables. //--------------------------------------------' class FA.Globals { //-------------------------------------------- // Static instance of the FAStack class. //-------------------------------------------- static public var instance:FA.Stack; //-------------------------------------------- // Get or create a static instance of the FAStack // class. //-------------------------------------------- static public function getStack () : FA.Stack { if (!FA.Globals.instance) { FA.Globals.instance = new FA.Stack(); } return FA.Globals.instance; } //-------------------------------------------- // Set a value in the stack. //-------------------------------------------- static public function set (key, value) : Void { var instance:FA.Stack = FA.Globals.getStack(); instance.push(key, value); } //-------------------------------------------- // Get a value from the stack. //-------------------------------------------- static public function get (key) { var instance:FA.Stack = FA.Globals.getStack(); return instance.get(key); } }