Provide a better visual feedback-using Flex cursormanager

Source: Internet
Author: User

Why do you need flex cursormanager

Flex is all aboutUser Experience. A rich Internet application (Ria) Is not just attractive skins or fancy animations. It also means interacting with users and helping them use your application better.

One important part of user experience isProvide a better visual feedback. For example, when someone types A model name and clicks Search button, it might take 2-3 seconds to get results from a Web service.What wocould a user do during that time?He or she probably keeps clicking the search button, or thinks your application is dead.

So how to let users know what is going on with your application? You need to give them some visual feedback: Like show the busy cursor when waiting for the back end response, and then remove the busy cursor when the data is ready.

To control the Cursor Image in flex, you needCursormanager.

How to Use cursormanager

Here is how you typically useCursormanagerInFlex:

 -Display the default busy cursor  Cursormanager. setbusycursor ();  -Remove the busy cursor    Cursormanager. removebusycursor (); -Create a new cursor from your own cursor class    [Bindable] [embed (Source = "assets/heart.gif")] private var heartcursor: class;  VaR cursorid: Int = cursormanager. setcursor (heartcursor );  -Removes a cursor from the cursor listCursormanager. removecursor (cursorid );  -Remove all cursors  Cursormanager. removeallcursors (); 

Sample Code

<? XML version = "1.0" encoding = "UTF-8"?> <Mx: Application xmlns: MX = "http://www.adobe.com/2006/mxml" layout = "absolute"><Mx: SCRIPT> <! [CDATA [import MX. Managers. cursormanager; private var cursorid: int; [Bindable] [embed (Source = "assets/heart.gif")] private var heartcursor: Class; private Function Showbusycursor (): void {cursormanager. setbusycursor ();} private Function Removebusycursor (): void {cursormanager. removebusycursor ();} private Function Showheartcursor (): void {cursorid = cursormanager. setcursor (heartcursor);} private Function Removeheartcursor (): void {cursormanager. removecursor (cursorid);}]> </MX: SCRIPT> <Mx: panel Title = "flex tutorial-cursor manager" width = "500" Height = "200" horizontalcenter = "0" verticalcenter = "0" verticalgap = "20" horizontalalign = "center" verticalalign = "Middle"> <mx: hbox> <mx: button label = "show busy cursor" Click = "showbusycursor ()"/> <mx: button label = "Remove busy cursor" Click = "removebusycursor () "/> </MX: hbox> <mx: hrule width =" 95% "/> <mx: hbox> <mx: button label = "show heart cursor" Click = "showheartcursor ()"/> <mx: button label = "Remove heart cursor" Click = "removeheartcursor () "/> </MX: hbox> </MX: Panel> </MX: Application>

Conclusion

CursormanagerOffers a convienent way for you to control Cursor Display in flex. By using it properly, you will provide a better visual feedback to users, thus enhance the user experience of your applicaton.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.