I trying to create a global variable which apparently must be defined using a new class, e.g.: I have just been adding AS code to event, etc. I have not had need to create any new classes. I don’t know how to do this in AS3. If someone could help me get going, I’m sure I could reference the variables from there. First of all, where do I create such a “package”?
Here’s what I’ve tried so far. I created an actionscript file, buffaloGlobals.as in the com folder of my flash root. It contains the following:
package com.buffaloGlobals
{
public class GlobalVarContainer
{
public static var vars:Object = {};
}
}
I then put the following in the place where I want to put something in to my global container:
import com.buffaloGlobals;
GlobalVarContainer.vars.groupingID = 1;
This gives me the error: Access of undefined property GlobalVarContainer
I should point out that I am trying to follow the instruction in: http://greenethumb.com/article/11/global-variables-in-as3
On the other hand, if that idea is too complex, … I have a movieclip actionscript that executes whenever any of 4 buttons is clicked. Is there a way of know which button triggered the clip?