4 Replies Latest reply on Jan 1, 2010 5:42 AM by Tunied

    ToolTipManagerImpl  is not very useful!!

    Tunied Level 1

      Hi guys ,


      I  found that , I can't use the  ToolTipManager to create my own custom tooltips. here is the issue:




            I want make my own custom tooltips , so i wrote a class implements the IToolTips interface. but .i also want to control the position of the tooltips


      so , if i use


      currentToolTips = ToolTipManager.createToolTip("ssssss" , _target.x , _target.y - 10);


      you can check the code of the ToolTipManagerImpl.as.


      public function createToolTip(text:String, x:Number, y:Number,
                                            errorTipBorderStyle:String = null,
                                            context:IUIComponent = null):IToolTip
           var toolTip:ToolTip = new ToolTip();


           var sm:ISystemManager = context ?
                                              context.systemManager as ISystemManager:
                                             FlexGlobals.topLevelApplication.systemManager as ISystemManager;


           var e:DynamicEvent;
           if (hasEventListener("addChild"))
               e = new DynamicEvent("addChild", false, true);
               e.sm = sm;
               e.toolTip = toolTip;
           if (!e || dispatchEvent(e))
               sm.topLevelSystemManager.toolTipChildren.addChild(toolTip as DisplayObject);


           if (errorTipBorderStyle)
               toolTip.setStyle("styleName", "errorTip");
               toolTip.setStyle("borderStyle", errorTipBorderStyle);


           toolTip.text = text;




           toolTip.move(x, y);
            // Ensure that tip is on  screen?
           //  Should x and y for error tip be tip of pointy border?


           // show effect?


            return toolTip as IToolTip;



      the createToolTip only can generate a normal ToolTips() class , so is not working for you to set the


      ToolTipManager.toolTipClass = MyOwnTooltipsClass;



      and also if you set the "toolTipCreate" call back function , like the doc(Implementing the IToolTip interface)


      told you to do . you can't control the position of the tooltips


      because it will call


      mx_internal function positionTip()




      So how can i do, if i both want create a custom tooltips ,and change the position ?

      what i do now is override the

      function move(x : Number , y : Number) : void

      but i don't think this is a good way.