• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Task: Follow the Mouse

Now that you know how to get the mouse location, and you know how to set the location of a movie clip, you can combine these two pieces to make a movie where a movie clip follows the cursor around the screen.

1.
Create a new Flash movie.

2.
Make a simple movie clip. Something like a small circle will do.

3.
Attach the following script the to movie clip:

onClipEvent (enterFrame) {
    this._x = _root._xmouse;
    this._y = _root._ymouse;
}


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint