Creating and removing a cursor in Flash Builder4

To use the Cursor Manager, you import the mx.managers.CursorManager class into your application, and then reference its static 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, by using the static 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 static 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.

<?xml version=”1.0″?>
<!– cursors\CursorManagerApp.mxml –>
<s:Application xmlns:fx=”;
import mx.managers.CursorManager;
// Define a variable to hold the cursor ID.
private var cursorID:Number = 0;
// Embed the cursor symbol.
private var waitCursorSymbol:Class;
// Define event listener to display the wait cursor
// and to load the image.
private function initImage(event:MouseEvent):void {
// Set busy cursor.
cursorID = CursorManager.setCursor(waitCursorSymbol);
// Load large image.
// Define an event listener to remove the wait cursor.
private function loadComplete(event:Event):void {
<!– Image control to load the image. –>
<mx:Image id=”image1″
<!– Button triggers the load. –>
<mx:Button id=”myButton” label=”Show” click=”initImage(event);”/>

~ by mjcprasad2000 on July 8, 2009.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: