PDA

View Full Version : Random Movement - User Intervention



offsetboy
September 29th, 2002, 10:38 AM
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

pom
September 29th, 2002, 11:16 AM
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:
theClip.onEnterFrame=randomMotion;
theClip.onRollOver=function(){
this.onEnterFrame=somethingElse;
}
theClip.onRollOut=function(){
this.onEnterFrame=randomMotion;
}pom :asian:

flex
September 29th, 2002, 11:37 AM
If you're not sure about the dynamic event handlers, check out the tutorial at:

http://www.kirupa.com/developer/actionscript/as_tricks.asp

pom
September 29th, 2002, 11:52 AM
Great link, flex :P By the way, don't you have AS tricks you want to share? I'm running out of ideas...

flex
September 29th, 2002, 12:01 PM
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.

offsetboy
September 29th, 2002, 12:07 PM
I used the script below to setup the random motion.

http://www.kirupa.com/developer/mx/random_motionMX.asp

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

pom
September 29th, 2002, 12:33 PM
Instead of putting onClipEvent (enterFrame){move();} in the clip, put this in the main timeline:
theClip.onEnterFrame=move;
theClip.onRollOver=function(){
this.onEnterFrame=null;
}
theClip.onRollOut=function(){
this.onEnterFrame=move;
}pom :asian:

flex
September 29th, 2002, 02:28 PM
Ilyas - I've done a quick new tutorial - it's posted.