3 Replies Latest reply on Jun 30, 2011 3:24 AM by aluisamartins

    HSlider Track Skin causing problems to HSliders' default value

    andrewthorp

      package com.aceofsales.assets.skins {

      import flash.display.GradientType;

      import flash.display.Graphics;

       

      import mx.core.UIComponent;

       

      public class HSliderTrackSkin extends UIComponent {

       

      override public function get height():Number{

      return 12;

      }

       

      override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void{

      super.updateDisplayList(unscaledWidth, unscaledHeight);

      var g:Graphics = this.graphics;

       

      g.beginGradientFill( GradientType.LINEAR, [0x555555,0x838383], [1.0,1.0], [0,255], verticalGradientMatrix( 0, 0, width, height ) );

      g.drawRoundRectComplex( 0, 0, width, height, 6, 6, 6, 6 );

      g.endFill();

       

      g.beginGradientFill( GradientType.LINEAR, [0x050505,0x313131], [1.0,1.0], [0,255], verticalGradientMatrix( 3, 3, width-6, 6 ) );

      g.drawRoundRectComplex( 3, 3, width-6, 6, 3, 3, 3, 3 );

      g.endFill();

      }

       

      }

       

       

       

      }

      That is my track skin class.
      My hslider looks like this:

      <mx:HSlider width="125" thumbOffset="1" minimum="1" maximum="999" value="100" trackSkin="{HSliderTrackSkin}" />

       

      If I remove the trackSkin="{}" value, it defaults to "100" and is to the right a little bit (10%) like it is supposed to be.

       

      If I keep the trackSkin set, it defaults to 1 and is anchored to the left.

       

      Any ideas?

       

      (Flex 3, by the way)