Web Design Talks
website design tips and tricks

Delay by Mouse Click

June 2, 2008 20:14 by anjel

This tutorial will show you the basis of deceleration. Your object will be moved to that place where you have clicked. You can download .fla file here slide2mouse_partial.fla (24.50 kb)

1. Create a new file. The size of scene is not so important.

2. On the main scene draw a circle and make a movie clip.

3. To do this press F8 and select Movie clip, then name it on your choice.

4. Now click over the clip by right mouse and select Actions. Insert the following code into Action's window:

onClipEvent (load) {
_x = 0;
_y = 0;
speed = 5;
}
onClipEvent (mouseDown) {
endX = _root._xmouse;
endY = _root._ymouse;
}
onClipEvent (enterFrame) {
_x += (endX-_x)/speed;
_y += (endY-_y)/speed;
}

Now you can run the clip by pressing CTRL+Enter.  That's it.

 

 


Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Related posts