How to change the default Flex busy/loading cursor with CSS or code
Flex provides a default busy cursor style which looks like a small clock. It can be shown easily, by calling CursorManager.setBusyCursor() and removed just as easily by calling CursorManager.removeBusyCursor(). I’m not a big fan of it, but fortunately it is easy enough to change through CSS or AS3.
The first option is probably the most common, and is using CSS. Just add the following into a css file, replacing the source path with the path to your loading asset. This will apply this cursor style anytime you call the CursorManager.setBusyCursor() method.
CursorManager
{
busy-cursor: Embed(source='/assets/loading/loading.swf');
}
The second method still essentially uses CSS, but it creates the style dynamically using ActionScript. Just use the following anywhere in your code:
[Embed(source='/assets/loading/loading.swf')]
private const customLoadingCursor:Class;
StyleManager.getStyleDeclaration('CursorManager').setStyle('busy-cursor', customLoadingCursor);</code>
5 Responses to How to change the default Flex busy/loading cursor with CSS or code
-
Calendar
May 2013 M T W T F S S « Jul 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 -
Meta






the CSS(first method) doesn’t work.
Hmm, odd, it should do. I think this was Flex 3, not sure about 4. Worth checking that the path to your image is correct…
Oops, It worked, It lacked mx|Cursor in my case
mx|CursorManager
{
busy-cursor: Embed(source=’/assets/loading/loading.swf’);
}
worked for me, thanks for this post!
Good stuff, glad you got it working. No worries!