Mouse ActionScript class has been extended in Scaleform by adding several static methods and properties. In ActionScript 1.0 it is possible to refer to extensions directly, as in Mouse.setCursorType(…). ActionScript 2.0 is less tolerant and it will “complain” about such calls. To quiet the ActionScript 2.0 compiler you should use the alternative access syntax as follows: Mouse"setCursorType".
getButtonsState() static method
public function getButtonsState(mouseIndex : Number) : Number
Scaleform version: 2.2
Returns state of mouse buttons. The returned value is a bit-mask where the index of bit equals the zero-based mouse button index. If the corresponding bit is set then the button is pressed.
Parameters
mouseIndex : Number – Zero-based mouse index.
getTopMostEntity() static method
public function getTopMostEntity([mouseIndex : Number]) : Object public function getTopMostEntity(testAll : Boolean, [mouseIndex : Number]) : Object public function getTopMostEntity(x : Number, y : Number) : Object public function getTopMostEntity(x : Number, y : Number, testAll: Boolean) : Object
Scaleform version: 1.2.34, multiple mouse cursors support since 2.2
This static method returns a target character underneath the mouse cursor or at the specified coordinates. This method also may differ between characters with button handlers set (e.g., onPress, onMouseDown, onRollOver) and without them. This distinction may be useful to filter out characters that have no handlers to handle mouse events.
This method is inverse to MovieClip.hitTest since the hitTest checks if x and y coordinates are inside of the particular object and the getTopMostEntity returns the actual object at the specified x and y coordinates. Thus, Mouse.getTopMostEntity(x, y).hitTest(x, y, true) == true.
Parameters
mouseIndex : Number – Zero-based mouse index.
testAll : Boolean – Indicates to look only for characters with button handlers (false) or for any character (true). If this parameter is not specified then getTopMostEntity assumes it is true .
x : Number, y : Number – Alternative coordinates at which to look for a character.
Example:
var listenerObj = new Object; listenerObj.onMouseMove = function() { var target = Mouse["getTopMostEntity"](); trace("Mouse moved, target = "+target); } Mouse.addListener(listenerObj); var target = Mouse["getTopMostEntity"](480, 10); trace("The character at the (480, 10) is " + target);
getPosition static method
public function getPosition(mouseIndex : Number) : flash.geom.Point
Scaleform version: 2.2
This method returns coordinates of the corresponding mouse cursor, in _root coordinate space. The returned value is an instance of flash.geom.Point.
Parameters
mouseIndex : Number – Zero-based mouse index.
setCursorType() static method
public function setCursorType(cursorType : Number, [mouseIndex : Number]) : void
Scaleform version: 1.2.32
This static method changes the mouse cursor according to the parameter cursorType. See “Changing mouse cursor” for details.
Parameters
cursorType : Number – Indicates type of cursor, one of the following: Mouse.ARROW, Mouse.HAND, Mouse.IBEAM.
mouseIndex : Number – Zero-based mouse index.