Accessibility

Flex cookbook beta

Displaying a hand cursor when the user rolls over the CheckBox control in Flex

by peterd_mm on August 22, 2008 Avg Rating 2.8 (5)   |   Log in to rate post.

Tagged with buttonMode , useHandCursor , MXML , ActionScript , Flex and other technologies , CheckBox

Problem Summary

You want to change the mouse cursor to a hand cursor when the user moves their mouse over a CheckBox control in your Flex application.

Solution Summary

The following example shows how you can display a hand cursor when the user rolls their mouse over the Flex CheckBox control by setting the useHandCursor and buttonMode properties.

Explanation

 <?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/08/15/displaying-a-hand-cursor-when-the-user-rolls-over-the-checkbox-control-in-flex/ --> <mx:Application name="CheckBox_useHandCursor_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white">
 
    <mx:CheckBox id="checkBox"
            label="useHandCursor"
            useHandCursor="{checkBox.selected}"
            buttonMode="true"
            selected="true" />
 
</mx:Application>

You can also set the useHandCursor property using ActionScript, as seen in the following example:

<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/08/15/displaying-a-hand-cursor-when-the-user-rolls-over-the-checkbox-control-in-flex/ --> <mx:Application name="CheckBox_useHandCursor_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white">
 
    <mx:Script>
        <![CDATA[
            private function checkBox_change(evt:Event):void {
                checkBox.useHandCursor = checkBox.selected;
            }
        ]]>
    </mx:Script>
 
    <mx:CheckBox id="checkBox"
            label="useHandCursor"
            useHandCursor="true"
            buttonMode="true"
            selected="true"
            change="checkBox_change(event);" />
 
</mx:Application>

For more information, see "Displaying a hand cursor when the user rolls over the CheckBox control in Flex" at FlexExamples.com.






Comments (0)

To add a comment, please Log in.








Flex cookbook home
Submit a post

rss

FLEX COOKBOOK RSS FEEDS
Recent: POSTS | COMMENTS | EDITS

Core Tags
Browse all posts
AIR (35)
ActionScript (277)
Architecture (41)
Behaviors and effects (33)
Charting (7)
Components (139)
Data (93)
Flex and other technologies (250)
MXML (229)
Security (19)
UI design (83)
Recent contributors
Greg Lafrance
zable
stinasius
Dean Pittsinger
wintondeshong
niallobrien
faqcontrib
Marvin Velo
BJWILD