< Day Day Up > |
Availability Flash MX 2004. Description The Tools object is accessible from the flash object (fl.tools). The tools.toolObjs property contains an array of ToolObj objects, and the tools.activeTool property returns the ToolObj object for the currently active tool. (See also "ToolObj object" on page 500 and "Extensible tools" on page 24.) NOTE The following methods and properties are used only when creating extensible tools. Method summary for the Tools objectThe following methods are available for the Tools object.
Property summary for the Tools objectThe following properties are available for the Tools object.
tools.activeToolAvailability Flash MX 2004. Usage tools.activeTool Description Read-only property; returns the ToolObj object for the currently active tool. Example The following example saves an object that represents the currently active tool in the theTool variable. var theTool = fl.tools.activeTool; tools.altIsDownAvailability Flash MX 2004. Usage tools.altIsDown Description Read-only property; a Boolean value that identifies if the Alt key is being pressed. The value is true if the Alt key is pressed, and false otherwise. Example The following example determines whether the Alt key is being pressed. var isAltDown = fl.tools.altIsDown; tools.constrainPoint()Availability Flash MX 2004. Usage tools.constrainPoint(pt1, pt2) Parameters pt1 and pt2 specify the starting-click point and the drag-to point. Returns A new adjusted or constrained point. Description Method; takes two points and returns a new adjusted or constrained point. If the Shift key is pressed when the command is run, the returned point is constrained to follow either a 45° constrain (useful for something such as a line with an arrowhead) or to constrain an object to maintain its aspect ratio (such as pulling out a perfect square with the rectangle tool). Example The following example returns a constrained point: pt2 = fl.tools.constrainPoint(pt1, tempPt); tools.ctlIsDownAvailability Flash MX 2004. Usage tools.ctlIsDown Description Read-only property; a Boolean value that is true if the Control key is pressed; false otherwise. Example The following example determines whether the Control key is being pressed. var isCtrldown = fl.tools.ctrlIsDown; tools.getKeyDown()Availability Flash MX 2004. Usage tools.getKeyDown() Parameters None. Returns The integer value of the key. Description Method; returns the most recently pressed key. Example The following example displays the integer value of the most recently pressed key in the Output panel. var theKey = fl.tools.getKeyDown(); fl.trace(theKey); tools.mouseIsDownAvailability Flash MX 2004. Usage tools.mouseIsDown Description Read-only property; a Boolean value that is true if the left mouse button is currently down; false otherwise. Example The following example determines whether the left mouse button is pressed. var isMouseDown = fl.tools.mouseIsDown; tools.penDownLocAvailability Flash MX 2004. Usage tools.penDownLoc Description Read-only property; a point that represents the position of the last mouse-down event on the Stage. The tools.penDownLoc property comprises two properties, x and y, corresponding to the x,y location of the mouse pointer. Example The following example determines the position of the last mouse-down event on the Stage and displays the x and y values in the Output panel. var pt1 = fl.tools.penDownLoc; fl.trace("x,y location of last mouseDown event was " + pt1.x + ", " + pt1.y) See also tools.penLoc tools.penLocAvailability Flash MX 2004. Usage tools.penLoc Description Read-only property; a point that represents the current location of the mouse pointer. The tools.penLoc property comprises two properties, x and y, corresponding to the x,y location of the mouse pointer. Example The following example determines the current location of the mouse. var tempPt = fl.tools.penLoc; See also tools.penDownLoc tools.setCursor()Availability Flash MX 2004. Usage tools.setCursor( cursor ) Parameters cursor An integer that defines the pointer appearance, as described in the following list:
Returns Nothing. Description Method; sets the pointer to a specified appearance. Example The following example sets the pointer to a black arrow. fl.tools.setCursor(1); tools.shiftIsDownAvailability Flash MX 2004. Usage tools.shiftIsDown Description Read-only property; a Boolean value that is TRue if the Shift key is pressed; false otherwise. Example The following example determines whether the Shift key is being pressed. var isShiftDown = fl.tools.shiftIsDown; tools.snapPoint()Availability Flash MX 2004. Usage tools.snapPoint(pt) Parameters pt specifies the location of the point for which you want to return a snap point. Returns A new point that may be adjusted or snapped to the nearest geometric object. Description Method; takes a point as input and returns a new point that may be adjusted or snapped to the nearest geometric object. If snapping is disabled in the View menu in the Flash user interface, the point returned is the original point. Example The following example returns a new point that may be snapped to the nearest geometric object. var theSnapPoint = fl.tools.snapPoint(pt1); tools.toolObjsAvailability Flash MX 2004. Usage tools.toolObjs Description Read-only property; an array of ToolObj objects (see ToolObj object). |
< Day Day Up > |