Skinning a ToolTip progamatically in flex

The class allow you to create a skin for the tooltip which can be further used as border skin of tooltip .

 /* ToolTipSkin.mxml*/

package 
{
 import mx.skins.ProgrammaticSkin;
 import mx.controls.Alert;

    public class ToolTipSkin extends ProgrammaticSkin {
     
        public static var _widthToApply:Number;
       
        public function ToolTipSkin() {}

        override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void {
            super.updateDisplayList(unscaledWidth, unscaledHeight)
            if(_widthToApply<60)
            _widthToApply=60;
            graphics.clear();
            graphics.lineStyle(0, 0, 0);
            graphics.beginFill(0xf4f400,1);
            graphics.moveTo(0,10)
            graphics.lineTo(0,25);
            graphics.lineTo(_widthToApply,25);
            graphics.lineTo(_widthToApply,10);
            graphics.lineTo(20,10);
            graphics.lineTo(10,2);
            graphics.lineTo(10,10);
            graphics.lineTo(0,10);
            graphics.endFill();  
        }

    }
}

ToolTipSkin can be used in the application style sheet as a class reference

 borderSkin: ClassReference(“ToolTipSkin”);

Post a Comment