I have an issue with the vertical alignment of an HSlider within a HBox that has multiple components. The HBox has a verticalAlign = middle. My slider has a custom track skin that extends the SliderTrackSkin class given by Flex. The problem is that the slider track is not vertically aligned with the HBox...
The reason this is more apparent is because Flex's slider track is like 2 pixels high. Mine is 8. It seems Flex does not take in account that the track skin should affect the positioning of the component. I've posted some code below for reference.
If anyone has a solution of setting a vertical offset to the slider component, I would love to hear it.
public class IngestSliderTrackSkin extends SliderTrackSkin
override public function get measuredHeight():Number
override protected function updateDisplayList(w:Number, h:Number):void
// User-defined styles.
var borderColor:Number = getStyle("borderColor");
var fillAlphas:Array = getStyle("fillAlphas");
var fillColors:Array = getStyle("trackColors") as Array;
// DRAW THE BORDER
drawRoundRect(-4, 0, w + 4, h, 3,
// DRAW THE FILL
drawRoundRect(-3, 1, w+2, h-2, 3,
verticalGradientMatrix(-3,1,w+2, h-2), GradientType.LINEAR, [0,255]);
trackColors: #424345, #FF0057;
fillAlphas: 1, 1;
My quick fix for this was to put the slider in a canvas, set the canvas to not clip the content and set the slider y value = slider height/2. Not a very clean solution. If anyone has any other suggestions let me know.