# Howto create a session variable in flash

**URL:** <https://forum.kirupa.com/t/howto-create-a-session-variable-in-flash/307038>\
**Category:** Uncategorized\
**Created:** [March 26, 2010, 3:08pm UTC](https://forum.kirupa.com/t/howto-create-a-session-variable-in-flash/307038 "2010-03-26T15:08:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![michaelafoley](https://avatars.discourse-cdn.com/v4/letter/m/3be4f8/32.png) [@michaelafoley](https://forum.kirupa.com/u/michaelafoley)\
**Post date:** [March 26, 2010, 3:08pm UTC](https://forum.kirupa.com/t/howto-create-a-session-variable-in-flash/307038/1 "2010-03-26T15:08:06Z")

</div>

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](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?
