# Passing global variable names?

**URL:** <https://forum.kirupa.com/t/passing-global-variable-names/169755>\
**Category:** Uncategorized\
**Created:** [November 19, 2005, 1:42am UTC](https://forum.kirupa.com/t/passing-global-variable-names/169755 "2005-11-19T01:42:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![neild](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/neild/32/1265_2.png) [@neild](https://forum.kirupa.com/u/neild)\
**Post date:** [November 19, 2005, 1:42am UTC](https://forum.kirupa.com/t/passing-global-variable-names/169755/1 "2005-11-19T01:42:26Z")

</div>

Hello -  
anyone have any idea how i might go about making this a little more managable?  
i have about 40 “buttons” that all run the same way -

[list]  
[_]set a unique variable to true on rollover and false on rollout  
[_]on rollover check every frame to see if its still onrollover and move the the timeline of the mc calling this function accordinglly (perfect tween - ch8, _flash to the core_)  
[\*]and so on  
[/list]i can pass everything i need to get this doen to one generic function except the actual name of the \_root.uniqueVAR - so all i came up with was this insane if/else stuff –

any ideas on how to clean up this mess?

many many thanks in advance -

About Button:

```auto
on(rollOver){
	[color=DarkRed] **_root.aboutVAR** [/color]=true;
	this.overme("aboutVAR");
}
on(rollOut){
	_root.aboutVAR=false;
}

```

Products Button:

```auto
on(rollOver){
   [color=DarkRed] **_root.productVAR** [/color]=true;
	this.overme("productVAR");
}
on(rollOut){
	_root.productVAR=false;
}

```

TimeLine AS:

```auto
MovieClip.prototype.overme=function(jumbo){
if ((jumbo=="aboutVAR")&&(_root.transStatus!="about")&&(_root.transActive!="2")){
		this.onEnterFrame=function(){
			if (**[color=DarkRed]_root.aboutVAR[/color]**) {
				this.nextFrame();
    		} else if ((**[color=DarkRed]_root.aboutVAR[/color]**!= true) && (this._currentframe<=1)){
				 delete this.onEnterFrame;
    		}else if ((**[color=DarkRed]_root.aboutVAR[/color]**!=true)&&(_root.transStatus!="about")){
				this.prevFrame();
			}
		} 
	//START PRODUCTS///////////////////////////////////////////////////////////
	}else if ((jumbo=="[color=Black]productVAR[/color]")&&(_root.transStatus!="products")&&(_root.transActive!="2")){
		this.onEnterFrame=function(){
			if (**[color=DarkRed]_root.productVAR[/color]**) {
				this.nextFrame();
		} else if (([color=DarkRed] **_root.productVAR** [/color] != true) && (this._currentframe<=1)){
				 delete this.onEnterFrame;
		}else if ((**[color=DarkRed]_root.productVAR[/color]**!=true)&&(_root.transStatus!="products")){
				this.prevFrame();
			}
		}
};

```
