2 Replies Latest reply on Sep 4, 2009 1:19 PM by tamuguen

    Where can I find the InteractionInputType Class? I've got a Slider and Buttons...

    tamuguen

      I've got an HSlider with some buttons over it, and what I'm trying to do is move the HSlider to whatever button is clicked.

      I've got that working, but the problem is that it just looks so stiff, since it automatically jumps straight to the value. So what I decided to do was, instead, dispatch a Slider-track click event, so that I could have the smooth transition like when someone clicks on the slider track:

       

      According to http://livedocs.adobe.com/flex/3/langref/mx/controls/sliderClasses/Slider.html#event:chang e I need to pass an InteractionInputType to the event dispatcher, and that's where I run into troubles, because I don't know where to find this class. I simply get thrown errors if I try to type it in.

       

      Can someone help me out, or possibly offer a smooth alternative?

       

       

      slide.dispatchEvent(new SliderEvent(SliderEvent.CHANGE,false,false,0,value,InteractionInputType.MOUSE,SliderEventClickTarget.TRACK,-1));
        • 1. Re: Where can I find the InteractionInputType Class? I've got a Slider and Buttons...
          Andrew Rosewarn

          Hmmm not sure mysef and as short on time today heres an alernative.  You can use the AnimatePropery class on most objects when your want to change their values.  See example.

           

          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
              <mx:Script>
                  <![CDATA[
                      import mx.effects.AnimateProperty;
                     
                      private function doAnim():void {
                          var anim:AnimateProperty = new AnimateProperty();
                      anim.target = hs;
                      anim.property = 'value'
                      anim.fromValue= hs.value;
                      anim.toValue = 10;
                      anim.duration = 500;
                      anim.play();
                      }
                     
                     
                  ]]>
              </mx:Script>
             
              <mx:HSlider id="hs" x="209" y="275" minimum="0" maximum="20" snapInterval="1" />
              <mx:Button x="341" y="245" label="Button" click="{doAnim()}"/>

           

          </mx:Application>

           

          As you say there is probably a better way to do this.

           

          Andrew