Web
Article

Flash Script – Finding Cursor Co-ordinates

By Georgina Laidlaw


Download the sample files here.

1. Create a movieclip from any object.

2. Give the movieclip instance a name – I used "drag".

3. Create two text fields give them variable names xtxt and ytxt.

4. Go to the drag movieclip timeline.

5. Create 2 keyframes as shown below:

1065_tool2

6.In the first key frame use the action:

startDrag ("/drag", true);  
/:xtxt = getProperty("/drag",_x);  
/:ytxt = getProperty("/drag",_y);

7. In the second key frame use the action:

gotoAndPlay (1); 

8. Bravo! You have made your own cool mouse position detector.

No Reader comments

Recommended

Learn Coding Online
Learn Web Development

Start learning web development and design for free with SitePoint Premium!

Instant Website Review

Use Woorank to analyze and optimize your website to improve your website to improve your ranking!

Run a review to see how your site can improve across 70+ metrics!

Get the latest in Front-end, once a week, for free.