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);

 

Leave a Reply

Your email address will not be published. Required fields are marked *

*

* Copy this password:

* Type or paste password here:

2,918 Spam Comments Blocked so far by Spam Free Wordpress

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>