ssCore.Mouse.getPosition

Get the position of the mouse cursor in screen coordinates or Flash coordinates.


Availability:

First available in version 3.4 build 222.


Input Parameters:

system - [Optional] - Indicates the coordinate system of the new x,y position. This can be the Flash coordinate system or the Screen coordinate system. Valid values include: flash and screen. Default value is Flash.


Output Parameters:

x - x position of mouse cursor in coordinates specified by the system parameter.

y - y position of mouse cursor in coordinates specified by the system parameter.


Asynchronous Mode:

When this method is called asynchronously, a return object containing the output parameters is passed to the specified callback function.

ssCore.Mouse.getPosition( paramsObject [, callbackParamsObject] [, errorParamsObject] );


Synchronous Mode:

When this method is called synchronously, a return object containing the output parameters is returned to the caller immediately.

var returnObject = ssCore.Mouse.getPosition( paramsObject );


Notes:

This is an easy way to determine where the mouse cursor is at any point in time without having to set up a notification handler for the onMouseMove event.

Examples:

// get the mouse cursor position in screen coordinates
var r:Object = ssCore.Mouse.getPosition({system:"screen"});
ssDebug.trace(r.x + "," + r.y);

// get the mouse cursor position using coordinates that match what
// Flash uses (i.e. relative to the upper left corner of your window
var r:Object = ssCore.Mouse.getPosition({system:"flash"});
ssDebug.trace(r.x + "," + r.y);