03
Nov
07

Toggling a Flex Slider control’s tickInterval property

The following example shows how you can toggle a Flex Slider control’s tick marks so they are only visible while the user’s mouse cursor is over the HSlider/VSlider control.

Full code after the jump.

View MXML

<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2007/11/03/toggling-a-flex-slider-controls-tickinterval-property/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white">

    <mx:Script>
        <![CDATA[
            import mx.controls.sliderClasses.Slider;

            private const TICK_INTERVAL:uint = 5;

            private function slider_rollOver(evt:MouseEvent):void {
                Slider(evt.currentTarget).tickInterval = TICK_INTERVAL;
            }

            private function slider_rollOut(evt:MouseEvent):void {
                Slider(evt.currentTarget).tickInterval = 0;
            }
        ]]>
    </mx:Script>

    <mx:HSlider id="slider"
            minimum="0"
            maximum="100"
            liveDragging="true"
            snapInterval="1"
            dataTipPrecision="0"
            rollOver="slider_rollOver(event);"
            rollOut="slider_rollOut(event);" />

</mx:Application>

View source is enabled in the following example.


0 Responses to “Toggling a Flex Slider control's tickInterval property”


  1. No Comments

Leave a Reply

This blog is terrible at eating HTML tags. If you plan on posting code/XML, please escape your "<" characters as "&lt;" and your ">" characters as "&gt;".