By default, Flex uses the system cursor as the application cursor. You control the system cursor by using the settings of your operating system.
The Flex Cursor Manager lets you control the cursor image in your Flex application. For example, if your application performs processing that requires the user to wait until the processing completes, you can change the cursor so that it reflects the waiting period. In this case, you can change the cursor to an hourglass or other image.
You also might want to change the cursor to provide feedback to the user to indicate the actions that the user can perform. For example, you can use one cursor image to indicate that user input is enabled, and another to indicate that input is disabled.
You can use a JPEG, GIF, PNG, or SVG image, or a SWF file as the cursor image.
To use the Cursor Manager, you import the mx.managers.CursorManager class into your application, and then reference its properties and methods.
The Cursor Manager controls a prioritized list of cursors, where the cursor with the highest priority is currently visible. If the cursor list contains more than one cursor with the same priority, the Cursor Manager displays the most recently created cursor.
You create a new cursor, and set an optional priority for the cursor, using the setCursor() method of the CursorManager class. This method adds the new cursor to the cursor list. If the new cursor has the highest priority, it is displayed immediately. If the priority is lower than a cursor already in the list, it is not displayed until the cursor with the higher priority is removed.
To remove a cursor from the list, you use the removeCursor() method. If the cursor is the currently displayed cursor, the Cursor Manager displays the next cursor in the list, if one exists. If the list ever becomes empty, the Cursor Manager displays the default system cursor.
The setCursor() method has the following signature:
setCursor(cursorSymbol:String, priorityLevel:Number, xOffset:Number,
yOffset:Number) : Number
The following table describes the arguments for the setCursor() method:
| Argument | Description | Req/Opt |
|---|---|---|
cursorSymbol |
Specifies a String that contains the symbol name of the cursor to display. |
Required |
priorityLevel |
Specifies a Number that contains the priority level of the cursor. Possible values are |
Optional |
xOffset |
Specifies a Number that contains the x offset of the |
Optional |
yOffset |
Specifies a Number that contains the y offset of the |
Optional |
This method returns the ID of the new cursor. You pass the ID to the removeCursor() method to delete the cursor. This method has the following signature:
static removeCursor(cursorID:Number) : Void
Version 1.5
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flex/15/flex_docs_en/00000609.htm
Comments
ChivertonT said on May 5, 2006 at 2:57 AM :