views:

41

answers:

0

Hi,

I'm trying to extend the spark textinput to create a custom component. When a tooltip message is passed to this component, it should show the tooltip message as an errortip on the rightside of the field.

    public class CustomTextInput extends TextInput
{
    public var toolTipMsg:ToolTip;
    public function CustomTextInput()
    {
        super();
        width = 220; 
        this.addEventListener(FocusEvent.FOCUS_IN,createMessage,false,0,true);
    }/*
    override protected function focusInHandler(event:FocusEvent):void {
        super.focusInHandler(event);
        createMessage(event);
        invalidateSkinState();
    }*/
    private function createMessage(event:Event):void{
        Alert.show("Creating tooltip");
        var toolTipMessageValue:String = "My tooltip";
        toolTipMsg = ToolTipManager.createToolTip(toolTipMessageValue,event.currentTarget.x+event.currentTarget.width,event.currentTarget.y,"errorTipRight",IUIComponent(event.currentTarget)) as ToolTip;
    }
}

But the tooltip never appears.

Can someone please help me with the suggestions?