Toggling a Flex Slider control’s tickInterval property

by Peter deHaan on November 3, 2007

in HSlider, Slider, VSlider

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.

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: