Cursor Management

By default, the Flex application cursor is an arrow, except when a selectable/editable text element has focus, at which point the cursor becomes a text selection cursor. Using the mx.managers.CursorManager class you can control the cursor that gets displayed in the application. This can be useful for giving the user a visual queue of the status of the application.

The CursorManager class has a handful of static methods that allow you to control the cursor by doing the following: showing and removing busy cursors and showing and removing custom cursors.

The Flex framework has just one built-in cursor apart from the default system cursors. The one built-in cursor is a busy cursor that displays a small clock face with a spinning hand to let the user know that something is being processed. The CursorManager class has two static methods for displaying and removing the busy cursor: setBusyCursor() and removeBusyCursor(). The following demonstrates a very simple example that sets and removes the busy cursor when the user clicks two buttons:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">

  <mx:Script>
  <![CDATA[

    import mx.managers.CursorManager;

  ]]>
  </mx:Script>

  <mx:VBox>
    <mx:Button label="Show Busy Cursor" click="CursorManager.setBusyCursor()" />
    <mx:Button label="Hide Busy Cursor" click="CursorManager.removeBusyCursor()"
/>
  </mx:VBox>

</mx:Application>

Typically, you would use the busy cursor for asynchronous operations such ...

Get Programming Flex 3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.