SliderDataTip border skinning fix (work in progress).

There's a small issue with the border of the data tip in the two Flex Slider classes (VSlider and HSlider) (which I raised yesterday. https://bugs.adobe.com/jira/browse/SDK-24282)

I quickly knocked up a fix for it that could either be placed in ToolTip, SliderDataTip or in an extension to SliderDataTip.

If the fix is going into the ToolTip class, then the styleChanged method becomes the following:


override public function styleChanged(styleProp:String):void 
{ 
    // This will take care of doing invalidateSize() if styleProp 
    // is "styleName" or a registered layout style such as "borderStyle". 
    super.styleChanged(styleProp); 
    // However, if the borderStyle changes from "errorTipAbove" to 
    // "errorTipBelow" or vice versa, the measured size won't change. 
    // (The pointy part of the skin simply changes from the bottom 
    // to the top or vice versa.) This means that the LayoutManager 
    // won't call updateDisplayList() because the size hasn't changed. 
    // But the TextField has to be repositioned, so we need to 
    // invalidate the layout as well as the size. 
    if (styleProp == "borderStyle" ||         styleProp == "styleName" ||         styleProp == "borderSkin" ||         styleProp == null         ) 
    { 
        if( !(border is getStyle("borderSkin")) ) 
        {
            if(border) 
                removeChild(DisplayObject(border)); 					                     var borderClass:Class = getStyle("borderSkin");
            border = new borderClass();
            if (border is ISimpleStyleClient)                 ISimpleStyleClient(border).styleName = this;
            addChildAt(DisplayObject(border), 0); 
        }
 
        invalidateDisplayList(); 
    } 
}


This basically adds a check to see if the borderSkin style has changed. If so it remakes the border in the same way it's originally made in createChildren.

If it's going into SliderDataTip or a subclass of ToolTip or SliderDataTip then add the above as an override to the styleChanged method, but also remember to import the mx_internal namespace and add the use namespace mx_internal line so that you can access the border property.

So far I've tested runtime changes to border styles in the style defined for dataTipSlideName in the relevant slider, and they appear to work fine. Changing the dataTipSlideName itself won't update the data tip while it's open, but will when it is next opened. Fixing this would require a seperate addition to the styleChanged method of the Slider class.

I'll try and get round to testing this a bit more and submitting it as a patch.