In the Fleb Framework, a very simple but efficient singleton class for handling global variables is used: VarCentral. You can easily use it for your own purpose, add any value (string, object, array… whatever) and access it from anywhere in your project.
Example
// import the class import net.kaegi.utils.VarCentral // add a value VarCentral.getInstance().vars = {foo:"bar"} // use value trace(VarCentral.getInstance().vars.foo) // returns "bar"
If you are lazy like me and don't want to re-type “VarCentral.getInstance().vars….” all the time you can use this shortcut:
// import the class import net.kaegi.utils.VarCentral // shortcut var varcentral:Object = VarCentral.getInstance().vars // add some values varcentral.foo = "bar"; varcentral.foo2 = "test"; varcentral.blabla = "gugus";
Now you can use these values from anywhere in your project (e.g. another SWF):
// import the class import net.kaegi.utils.VarCentral // shortcut var varcentral:Object = VarCentral.getInstance().vars // use values trace(varcentral.foo) trace(varcentral.foo2) trace(varcentral.blabla) // returns: // "bar" // "test" // "gugus"
You should not overwrite the following global variables used by the Fleb Framework itself. But it is easy to avoid it, they all start with “fleb”. They are listed here in two groups: the first one you may use for your own purpose and the second one which you will probably never use directly.
Initialised in net.kaegi.utils.VarCentral
Central event system. More infos here.
Initialised in net.kaegi.fleb.Startup
Use this variable to directly access public methods you may have created in Base.as
Initialised in net.kaegi.fleb.Startup
The preloader movieclip is stored in this variable.
Initialised in net.kaegi.fleb.Startup
Stores the language code.
Initialised in net.kaegi.fleb.Startup
Stores a reference to the stage object.
Initialised in net.kaegi.fleb.Core
Use this variable to directly access public methods you have created in Main.as
Initialised in net.kaegi.fleb.Core
Stores a reference to the sprite/movieclip that holds the loaded content pages.
Initialised in net.kaegi.fleb.Core
Stores a reference to the sprite/movieclip that holds the global navigation.
Initialised in net.kaegi.fleb.Core
Stores a reference to the global navigation manager class.
Initialised in net.kaegi.fleb.Core
Stores a reference to the font manager class. There is only one public method available: getStyleSheet()
Initialised in net.kaegi.fleb.Core
Stores the button ID of the currently active content page (defined in structure.xml)
Initialised in net.kaegi.fleb.Core
Stores the button ID of the previously active content page (defined in structure.xml)
Initialised in net.kaegi.fleb.Core
Stores the data object of the currently active content page (defined in structure.xml):
The arrays (swfArr etc.) contain 5 values for 5 languages. For example, if varcentral.flebLanguage is 2, then the third element of the arrays will be used.
Initialised in net.kaegi.fleb.Core
Stores the data object of the previously active content page (defined in structure.xml):
Initialised in net.kaegi.fleb.Core
Stores a reference to the currently active NavigationButton2.
Initialised in net.kaegi.fleb.Core
Stores a reference to the NavigationButton2 that was active before the current button.
Initialised in net.kaegi.fleb.PageLoader
Stores a reference to the currently active content page.
Initialised in net.kaegi.fleb.PageLoader
Stores a reference to the previously active content page.
Initialised in net.kaegi.fleb.Core
Stores a reference to net.kaegi.fleb.Core
Initialised in net.kaegi.fleb.Startup