Flash tutorials
Home 3D (2) Actionscripting (65) Animation (100) Audio (4) Drawing (7) Full flash sites (4) Getting Started (15) Navigation (25) Special Effects (52) Text Effects (38)

Mouse x-y Coordinates

29.8.2006, 23:49    Total views: 41242
Any visual object on stage are represented by x and y coordinates. This tutorial will show you how to create some object which will follow a mouse moving, using action script.



Step 1

Create a new flash document, draw some object or import any picture (Ctrl+R - Import to Stage), select it and press F8 on the keyboard (Convert to Symbol) to convert it into a Movie Clip.

 





Step 2


While your object is still selected, open the Action Script Panel (F9), and paste this script:

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

Test your movie (Ctrl+Enter)

We're done!

Bye!

Download source file (.fla)
Have questions about this tutorial?
Visit our friendly Community Forums!
Digg it! Add this tutorial to del.icio.us! Furl it! Add this tutorial to reddit! Spurl it! Add this tutorial to technorati!

Top tutorials

1. Advanced full flash site - Part 1
Total views: 221536

2. Water effect
Total views: 166040

3. Photo slide show
Total views: 153641

4. High-tech city animation
Total views: 151459

5. Special Picture Effect
Total views: 146246

Related links