type = 'application/x-shockwave-flash'
data = 'http://sitepointstatic.com/flash/crosshair.swf'
width = '400'
height = '400'
bgcolor = 'black'

Want to make a cross hair cursor in Flash? Look no further!
Download the sample files here.

1. First, create a line with a length that’s equal to the length of the stage.

2. Convert the line to a movie clip, and give it an instance name of "yline".

3. Drag an instance of the line movie clip from the library, and give this an instance name "xline".

4. Create a small circle, and convert this to a movie clip.

5. Right click the circle movie clip, go to actions, and insert:

onClipEvent (enterFrame)  
startDrag ("", true);
setProperty ("/yline", _y, _y);
setProperty ("/xline", _x, _x);

That’s it, run the movie! You have created a simple cross hair cursor.

Georgina has more than fifteen years' experience writing and editing for web, print and voice. With a background in marketing and a passion for words, the time Georgina spent with companies like Sausage Software and sitepoint.com cemented her lasting interest in the media, persuasion, and communications culture.

No Reader comments

Special Offer
Free course!

Git into it! Bonus course Introduction to Git is yours when you take up a free 14 day SitePoint Premium trial.