# PROBS passing onEnterFrame parameters

**URL:** <https://forum.kirupa.com/t/probs-passing-onenterframe-parameters/28506>\
**Category:** Uncategorized\
**Created:** [August 14, 2003, 1:35pm UTC](https://forum.kirupa.com/t/probs-passing-onenterframe-parameters/28506 "2003-08-14T13:35:50Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mindfriction](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/mindfriction/32/172_2.png) [@mindfriction](https://forum.kirupa.com/u/mindfriction)\
**Post date:** [August 14, 2003, 1:35pm UTC](https://forum.kirupa.com/t/probs-passing-onenterframe-parameters/28506/1 "2003-08-14T13:35:50Z")

</div>

Hi guys and girls,

Having a few problems. I give a number of mc’s an onEnterFrame event on the fly (in a for loop) which calls an easing function. This function is passed a variable whos value is worked out incrementally, ie on each loop the value is incremented (+=).  
I do this because I want each mc to be horizontally offset, in other words each clip eases so they come one after the other. Hope this makes sense, ANYWAY the problem the value of the variable (I mentioned above) which each clip uses to determine the postion it has to ease to seems to constantly reset itself. In other words the clips ease right on top of each other since the variable is reset to the last value it obtained from the last increment!!!. Anyone help!??

```auto

trace("yes");
	panelAmt = 5;
	speed = 4;
	tabWidth = 20.5;
		
	for(i=1;i<=panelAmt;i++)
	{
		
		this["panel" + i].onEnterFrame = function(leftAlign)
		{
			
			//var leftAlign = tabWidth*i;//offsets left alignment
			this._x += (temp-this._x)/speed;
			trace(speed);
			trace(this + " " + leftAlign);
		}
		leftAlign+=tabWidth;
		
	}

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 14, 2003, 1:38pm UTC](https://forum.kirupa.com/t/probs-passing-onenterframe-parameters/28506/2 "2003-08-14T13:38:41Z")

</div>

onEnterFrame events recieve no arguments. Where is leftAlign supposed to come from?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 14, 2003, 1:58pm UTC](https://forum.kirupa.com/t/probs-passing-onenterframe-parameters/28506/3 "2003-08-14T13:58:08Z")

</div>

Hmm I think I just figured it out Sen, rather daft of me to think that I could pass onEnterFrame arguments:sigh: . I just gave each instance a variable and initialised it at the same time…  
… Im just trying to create sliding tabs, Im now onto the part where I have to figure out how to slide tabs relative to which one is clicked…ie shuffle the inactive ones.

```auto

stop();

speed = 4;
tabWidth = 20.5;
tabAmt = 5;

for(i=1;i<=tabAmt;i++)
{
	this["panel" + i].leftPos = tabWidth*i;
	this["panel" + i].onEnterFrame = function()
	{
		this._x += (this.leftPos-this._x)/speed;	
	}
	
}

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 14, 2003, 2:00pm UTC](https://forum.kirupa.com/t/probs-passing-onenterframe-parameters/28506/4 "2003-08-14T14:00:46Z")

</div>

there ya go :beam:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 14, 2003, 2:06pm UTC](https://forum.kirupa.com/t/probs-passing-onenterframe-parameters/28506/5 "2003-08-14T14:06:00Z")

</div>

i find problem solving quite exciting up till the 1hr mark, then it gets frustrating, ive been working on this for 20mins so Im still at the “excitement” stage, lol

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 14, 2003, 2:11pm UTC](https://forum.kirupa.com/t/probs-passing-onenterframe-parameters/28506/6 "2003-08-14T14:11:56Z")

</div>

oO one quick question Sen how can I check for a particular instance of an MC ?

```auto

key = panel3;

for(i=1;i<tabAmt;i++)
{

if(this["panel" + i]._name == key)
{
 trace("FOUND");

}
}

```

going to work?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 14, 2003, 2:22pm UTC](https://forum.kirupa.com/t/probs-passing-onenterframe-parameters/28506/7 "2003-08-14T14:22:46Z")

</div>

key = “panel3”;

or

if(this[“panel” + i] == key)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 14, 2003, 3:36pm UTC](https://forum.kirupa.com/t/probs-passing-onenterframe-parameters/28506/8 "2003-08-14T15:36:25Z")

</div>

HOORAY FOR ME ! 🙂

Hey Senoc, I finished my first version of my sliding tabs thingy! Thought you might want to take a look :p:

Any ideas for optimization??

**post reply for attachment**
