MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT Reference Manual page 95

Actionscript reference guide
Hide thumbs Also See for FLASH MX 2004 - ACTIONSCRIPT:
Table of Contents

Advertisement

Buttons still function when you use a custom pointer. It's a good idea to put the custom pointer
on the top layer of the Timeline so that it moves in front of buttons and other objects as you move
the mouse in the SWF file. Also, the tip of a custom mouse pointer is the registration point of the
movie clip you're using as the custom pointer. Therefore, if you want a certain part of the movie
clip to act as the mouse tip, set the registration point coordinates of the clip to be that point.
For more information about the methods of the Mouse class, see the
Chapter 12, "ActionScript Dictionary," on page
Getting the mouse position
You can use the
(cursor) in a SWF file. Each Timeline has an
location of the mouse within its coordinate system. The position is always relative to the
registration point. For the main Timeline (
left corner.
The _xmouse and _ymouse properties within the main Timeline and a movie clip Timeline
The following procedures show two ways to get the mouse position.
To get the current mouse position within the main Timeline:
Create two dynamic text boxes, and name them
1
Select Window > Development Panels > Actions to open the Actions panel if it is not
2
already visible.
To return the mouse position within the main Timeline, add the following code to any frame
3
in the
_level0
x_pos = _root._xmouse;
y_pos = _root._ymouse;
The variables
x_pos
You could use these variables in any script in your document. In the following
handler, the values of
onClipEvent(mouseMove){
x_pos = _root._xmouse;
y_pos = _root._ymouse;
}
and
_xmouse
_ymouse
SWF file:
and
are used as containers to hold the values of the mouse positions.
y_pos
and
x_pos
y_pos
205.
properties to find the location of the mouse pointer
and
_xmouse
_ymouse
), the registration point is the upper
_level0
and
x_pos
update every time the user moves the mouse.
Creating interactivity and visual effects
Mouse class
entry in
property that returns the
.
y_pos
onClipEvent()
95

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004 - ACTIONSCRIPT and is the answer not in the manual?

Table of Contents