# Movement when rollover!

**URL:** <https://forum.kirupa.com/t/movement-when-rollover/6828>\
**Category:** Uncategorized\
**Created:** [October 17, 2002, 10:38am UTC](https://forum.kirupa.com/t/movement-when-rollover/6828 "2002-10-17T10:38:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jerry](https://avatars.discourse-cdn.com/v4/letter/j/5daacb/32.png) [@jerry](https://forum.kirupa.com/u/jerry)\
**Post date:** [October 17, 2002, 10:38am UTC](https://forum.kirupa.com/t/movement-when-rollover/6828/1 "2002-10-17T10:38:07Z")

</div>

hey!

I’m trying to make an object (MC) move, when rolling over a button! I got 2 buttons, one to get the object to move up, and one to get it to move down!

I found this code:

```auto
onClipEvent (load) {
	amount = 5;
}
onClipEvent (enterFrame) {
	if (_root._ymouse>350 && this._y>"-100") {
		this._y -= amount;
	}
	if (_root._ymouse<180 && this._y<"630") {
		this._y += amount;
	}
}

```

it’s the same function I’m looking for, where I can define the limit for the movement, but I can’t quite figure out how to apply the function to the buttons, so the object only moves when rolling over the buttons!?..

---

<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:** [October 17, 2002, 11:14am UTC](https://forum.kirupa.com/t/movement-when-rollover/6828/2 "2002-10-17T11:14:07Z")

</div>

I’d do it the other way around: when you rollover the button, it tells the clip to move:

```auto
on (RollOver) {
    _root.yourClip._x+=10;
}

```

Or something like that.

Cheers.

pom :asian:

[SIZE=1]spam: Vote for the contest please :)[/SIZE]

---

<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:** [October 17, 2002, 11:25am UTC](https://forum.kirupa.com/t/movement-when-rollover/6828/3 "2002-10-17T11:25:13Z")

</div>

THX, I’m getting there…

but I can’t get the MC to move smoothly, I want it to move until it reach a specific limit, and then stop!..?

---

<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:** [October 17, 2002, 1:42pm UTC](https://forum.kirupa.com/t/movement-when-rollover/6828/4 "2002-10-17T13:42:55Z")

</div>

Dynamic callback functions, man. I tried to explain it in the AS tricks section. Check it and if you are still clueless, post back.

pom 🙂
