# Random Movement - User Intervention

**URL:** <https://forum.kirupa.com/t/random-movement-user-intervention/6096>\
**Category:** flash\
**Created:** [September 29, 2002, 2:38pm UTC](https://forum.kirupa.com/t/random-movement-user-intervention/6096 "2002-09-29T14:38:01Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![offsetboy](https://avatars.discourse-cdn.com/v4/letter/o/9de0a6/32.png) [@offsetboy](https://forum.kirupa.com/u/offsetboy)\
**Post date:** [September 29, 2002, 2:38pm UTC](https://forum.kirupa.com/t/random-movement-user-intervention/6096/1 "2002-09-29T14:38:01Z")

</div>

Kinda of new to all this Flash stuff and need some help working on an animation.

I want to have four circles move around the screen randomly. When the user moves his mouse over a circle, I would like it to stop and be bale to use it as a link.

I have used the Flash MX script off the site and can get the circles to move about fine. Just haveing some problems getting them to stop when the mouse is moved over them, and making them into links.

Could anyone maybe get me started?

Thanks

Offsetboy

---

<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 29, 2002, 3:16pm UTC](https://forum.kirupa.com/t/random-movement-user-intervention/6096/2 "2002-09-29T15:16:23Z")

</div>

What script do you use to achieve the random motion?

Anyway, the most important here is to work with functions. Doing so, you’ll be able to change very easily the behaviour of your clips:

```auto
theClip.onEnterFrame=randomMotion;
theClip.onRollOver=function(){
   this.onEnterFrame=somethingElse;
}
theClip.onRollOut=function(){
   this.onEnterFrame=randomMotion;
}

```

pom :asian:

---

<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 29, 2002, 3:37pm UTC](https://forum.kirupa.com/t/random-movement-user-intervention/6096/3 "2002-09-29T15:37:05Z")

</div>

If you’re not sure about the dynamic event handlers, check out the tutorial at:

[http://www.kirupa.com/developer/actionscript/as\_tricks.asp](http://www.kirupa.com/developer/actionscript/as_tricks.asp)

---

<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 29, 2002, 3:52pm UTC](https://forum.kirupa.com/t/random-movement-user-intervention/6096/4 "2002-09-29T15:52:10Z")

</div>

Great link, flex 😛 By the way, don’t you have AS tricks you want to share? I’m running out of ideas…

---

<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 29, 2002, 4:01pm UTC](https://forum.kirupa.com/t/random-movement-user-intervention/6096/5 "2002-09-29T16:01:31Z")

</div>

I’m still posting off fla’s here and there, modifying people’s work, etc - trying to help out people stuck or starting out. Most of my AS tips are games design - I’ll leave the funky tornado effects to you! ![](http://flex.funkyolive.com/im/cool.gif)

But I will hopefully be putting up some other useful tutorials too. I know what the frequent questions here are so I’ll base them around that.

---

<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 29, 2002, 4:07pm UTC](https://forum.kirupa.com/t/random-movement-user-intervention/6096/6 "2002-09-29T16:07:09Z")

</div>

I used the script below to setup the random motion.

[http://www.kirupa.com/developer/mx/random\_motionMX.asp](http://www.kirupa.com/developer/mx/random_motionMX.asp)

Any ideas how I go about adding the extra code you gave me?

---

<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 29, 2002, 4:33pm UTC](https://forum.kirupa.com/t/random-movement-user-intervention/6096/7 "2002-09-29T16:33:10Z")

</div>

Instead of putting onClipEvent (enterFrame){move();} in the clip, put this in the main timeline:

```auto
theClip.onEnterFrame=move;
theClip.onRollOver=function(){
   this.onEnterFrame=null;
}
theClip.onRollOut=function(){
   this.onEnterFrame=move;
}

```

pom :asian:

---

<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 29, 2002, 6:28pm UTC](https://forum.kirupa.com/t/random-movement-user-intervention/6096/8 "2002-09-29T18:28:20Z")

</div>

Ilyas - I’ve done a quick new tutorial - it’s posted.
