The following code shows how you can toggle the “busy” cursor in Flex using the static setBusyCursor() and removeBusyCursor() methods in the CursorManager class, as well as using your own custom cursors by calling the static setCursor() and removeCursor() methods.
Full code after the jump.
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2007/09/10/changing-the-cursor-in-a-flex-application-using-the-cursormanager-class/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">
<mx:Script>
<![CDATA[
import mx.managers.CursorManager;
[Bindable]
[Embed(source="assets/bug.png")]
private var BugIcon:Class;
[Bindable]
[Embed(source="assets/bug_delete.png")]
private var BugDeleteIcon:Class;
private var cursorID:int;
]]>
</mx:Script>
<mx:ApplicationControlBar dock="true">
<mx:Button label="setBusyCursor()"
click="CursorManager.setBusyCursor();" />
<mx:Button label="removeBusyCursor()"
click="CursorManager.removeBusyCursor();" />
</mx:ApplicationControlBar>
<mx:Button label="setCursor()"
width="100"
height="100"
rollOver="cursorID = CursorManager.setCursor(BugIcon);"
rollOut="CursorManager.removeCursor(cursorID);" />
</mx:Application>
View source is enabled in the following example.





cool………..!
As usual very useful! Thanks!
Hi,
I set the cursor of a textinput using CursorManager
The new cursor is showing but it also showing the default text cursor on roll over of the text box.
How can I solve it?
Thanks
Anz
http://www.flickrmailer.com
I was using the setBusyCursor() and removeBusyCursor() methods in my application,until I had two tabs in my app which loaded once my Application initialized.Both these tabs make remote method calls,and display the busy cursor until the results come back.This resulted in the busy cursor getting converted into a normal cursor before the data come back.Here is a blog post related to this and how we could use a progress bar instead and pointers on ProgressBar:
http://flex-j2ee.blogspot.com/2008/01/flex-progressbar-versus-cursormanager.html
I am trying to create a custom set of cursors for my app tha dont have to be turned on, can this code be edited so it is automatically switched on without a button needed to be pressed?