Toggling item roll over highlighting on a List control in Flex

by Peter deHaan on September 20, 2008

in List

The following example shows how you can toggle item roll over highlighting on a Flex List control by setting the useRollOver style.

Full code after the jump.

<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/09/20/toggling-item-roll-over-highlighting-on-a-list-control-in-flex/ -->
<mx:Application name="List_useRollOver_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white">

    <mx:Array id="arr">
        <mx:Object label="Button"
                icon="@Embed('assets/Button.png')" />
        <mx:Object label="ButtonBar"
                icon="@Embed('assets/ButtonBar.png')" />
        <mx:Object label="CheckBox"
                icon="@Embed('assets/CheckBox.png')" />
        <mx:Object label="ColorPicker"
                icon="@Embed('assets/ColorPicker.png')" />
        <mx:Object label="ComboBox"
                icon="@Embed('assets/ComboBox.png')" />
        <mx:Object label="DataGrid"
                icon="@Embed('assets/DataGrid.png')" />
        <mx:Object label="DateChooser"
                icon="@Embed('assets/DateChooser.png')" />
        <mx:Object label="DateField"
                icon="@Embed('assets/DateField.png')" />
        <mx:Object label="HorizontalList"
                icon="@Embed('assets/HorizontalList.png')" />
        <mx:Object label="HRule"
                icon="@Embed('assets/HRule.png')" />
        <mx:Object label="HScrollBar"
                icon="@Embed('assets/HScrollBar.png')" />
        <mx:Object label="HSlider"
                icon="@Embed('assets/HSlider.png')" />
    </mx:Array>

    <mx:ApplicationControlBar dock="true">
        <mx:Form styleName="plain">
            <mx:FormItem label="useRollOver:">
                <mx:CheckBox id="checkBox" selected="true" />
            </mx:FormItem>
        </mx:Form>
    </mx:ApplicationControlBar>

    <mx:List id="list"
            dataProvider="{arr}"
            useRollOver="{checkBox.selected}"
            verticalScrollPolicy="on"
            width="150" />

</mx:Application>

Leave a Comment

Sorry, this blog is terrible at eating HTML comments.
If you're pasting any HTML/XML/MXML code, you need to convert your < characters to &lt; and your > characters to &gt; .

You can 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> <pre lang="" line="" escaped="">

Anti-Spam Protection by WP-SpamFree

Previous post:

Next post: