# Dynamic onenterframe

**URL:** <https://forum.kirupa.com/t/dynamic-onenterframe/63023>\
**Category:** Uncategorized\
**Created:** [September 2, 2004, 11:53am UTC](https://forum.kirupa.com/t/dynamic-onenterframe/63023 "2004-09-02T11:53:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![gerartje](https://avatars.discourse-cdn.com/v4/letter/g/e19adc/32.png) [@gerartje](https://forum.kirupa.com/u/gerartje)\
**Post date:** [September 2, 2004, 11:53am UTC](https://forum.kirupa.com/t/dynamic-onenterframe/63023/1 "2004-09-02T11:53:09Z")

</div>

hello,

i have attached 4 squares (attachMovie) with a for-lus and i assigned a rollover and a rollout to them.  
If I go over a square, an onenterframe starts, and the square is getting bigger.  
When i rollout, the square is getting his normal size again.  
No when I move rapidly to another square, the problem starts. And the first square doesn’n reach his final width. The first square is even getting widther when I roll over the second square.  
All the code is in one frame.

I’ve tried to put the code on a movieclip, so at the square itself, and then it works, but isn’t it possibly to do it the first way? To put the code all in one frame?

Tnx

---

<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:** [September 2, 2004, 12:25pm UTC](https://forum.kirupa.com/t/dynamic-onenterframe/63023/2 "2004-09-02T12:25:16Z")

</div>

> [@gerartje](#):
>
> hello,
> 
> i have attached 4 squares (attachMovie) with a for-lus and i assigned a rollover and a rollout to them.  
> If I go over a square, an onenterframe starts, and the square is getting bigger.  
> When i rollout, the square is getting his normal size again.  
> No when I move rapidly to another square, the problem starts. And the first square doesn’n reach his final width. The first square is even getting widther when I roll over the second square.  
> All the code is in one frame.
> 
> I’ve tried to put the code on a movieclip, so at the square itself, and then it works, but isn’t it possibly to do it the first way? To put the code all in one frame?
> 
> Tnx

here u go…  
if u have any questions about the fla. don’t afraid to ask…

---

<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:** [September 2, 2004, 8:19pm UTC](https://forum.kirupa.com/t/dynamic-onenterframe/63023/3 "2004-09-02T20:19:35Z")

</div>

tnx mate

I had to work indeed with prototypes

---

<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:** [September 3, 2004, 6:11am UTC](https://forum.kirupa.com/t/dynamic-onenterframe/63023/4 "2004-09-03T06:11:26Z")

</div>

but your onEnterFrame is always running/checking for the hitTest… hmm

---

<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:** [September 3, 2004, 11:00am UTC](https://forum.kirupa.com/t/dynamic-onenterframe/63023/5 "2004-09-03T11:00:20Z")

</div>

> [@gerartje](#):
>
> but your onEnterFrame is always running/checking for the hitTest… hmm

i didn’t understand the question…

---

<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:** [September 4, 2004, 7:22am UTC](https://forum.kirupa.com/t/dynamic-onenterframe/63023/6 "2004-09-04T07:22:17Z")

</div>

A little different, with deleting the onEnterFrame

```auto
mSpeed = 7;
for (mNum=1; mNum<5; mNum++) {
	mc = this.attachMovie("mc"+mNum, "MC"+mNum, this.getNextHighestDepth());
	mc._alpha = 70;
	mc._y = Stage.height/2;
	mc._x = 100+(mNum-1)*200;
	mc.onRollOver = function() {
		this.mScale(150);
	};
	mc.onRollOut = function() {
		this.mScale(100);
	};
}
MovieClip.prototype.mScale = function(dX) {
	this.onEnterFrame = function() {
		this._xscale += (dX-this._xscale)/mSpeed;
		this._yscale = this._xscale;
		if (Math.abs(this._xscale-dX)<1) {
			this._xscale = this._yscale=dX;
			delete this.onEnterFrame;
		}
	};
};

```

scotty(-:
