3 Replies Latest reply on Mar 11, 2008 1:42 PM by Gregory Lafrance

    Tooltips on ui.graphics

    samuel2202
      Hi,

      I have been created a rect with a UICompoment object :

      Action Script
      ui.graphics.beginFill(0x000000, 0.5);
      ui.graphics.drawRect(100, 100, 200, 200);
      ui.graphics.endFill();


      I want to attach a simple tootip to this rect...
      Is it possible ?

      Thanx a lot
        • 1. Re: Tooltips on ui.graphics
          Gregory Lafrance Level 6
          FB help says:

          Every visual Flex component that extends the UIComponent class (which implements the IToolTipManagerClient interface) supports a toolTip property. This property is inherited from the UIComponent class.
          • 2. Re: Tooltips on ui.graphics
            samuel2202 Level 1
            Thanx but...
            How do this ? :?
            • 3. Re: Tooltips on ui.graphics
              Gregory Lafrance Level 6
              Here is one way:

              ------------------ comp/MyRect.as -----------------------
              package comp
              {
              import mx.core.UIComponent;

              public class MyRect extends UIComponent{
              public function MyRect(){
              super();
              }

              override protected function updateDisplayList(unscaledWidth:Number,
              unscaledHeight:Number):void {
              super.updateDisplayList(unscaledWidth, unscaledHeight);
              graphics.beginFill(0xffcccc, 0.5);
              graphics.drawRect(100, 100, 200, 200);
              graphics.endFill();
              }
              }
              }
              ---------------------- Test.mxml --------------------------
              <?xml version="1.0" encoding="utf-8"?>
              <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" xmlns:comp="comp.*" initialize="init()">
              <mx:Script>
              <![CDATA[
              import comp.MyRect;

              private function init():void{
              var rect:MyRect = new MyRect();
              rect.toolTip = "Here is a tooltip for my rect...";
              addChild(rect);
              }
              ]]>
              </mx:Script>
              </mx:Application>