0 Replies Latest reply on Jul 20, 2007 11:53 AM by patmck47

    tooltips

    patmck47
      I have a map and i want each dot -- on mouseover -- to display address information, So i thought i'd use tooltips. but i want multilines and html. I can't get that to work. here is the main code:

      // create the tooltip clip
      _root.createEmptyMovieClip("ToolTip", 15999);
      // add the tooltip background box
      _root.ToolTip.createEmptyMovieClip("TipBackground", 1);
      with (_root.ToolTip.TipBackground) {
      beginFill(0xffcc00, 100);
      lineStyle(1, 0x000000, 100);
      moveTo(0, 0);
      lineTo(110, 0);
      lineTo(110, 15);
      lineTo(0, 15);
      lineTo(0, 0);
      endFill();
      }
      var my_fmt:TextFormat = new TextFormat();
      my_fmt.font = "Arial";
      my_fmt.size = 10;
      my_fmt.bold = false;
      // add the tooltip textfield. you could easily apply a
      // textFormat to this to customise the text more.
      _root.ToolTip.createTextField("TipText", 2, 2, 0, 100, 20);
      _root.toolTipText.multiline = true;
      _root.ToolTip.TipText.multiline = true;
      _root.ToolTip.TipText.html = true;
      _root.ToolTip.TipText.type = "dynamic";

      _root.ToolTip.TipText.setNewTextFormat(my_fmt);
      // hide the tip initially
      CloseTip();
      // mouse listener for tooltips
      TipMover = new Object();
      TipMover.onMouseMove = function() {
      ToolTip._x = _xmouse;
      ToolTip._y = _ymouse+20;
      };
      // adds a text-description of the buttons function
      function DisplayTip(tip) {
      Mouse.addListener(TipMover);
      ToolTip._x = _xmouse;
      ToolTip._y = _ymouse+20;
      ToolTip.swapDepths(15999);
      ToolTip._alpha = 100;
      ToolTip.TipText.text = tip;
      ToolTip.TipText.width = ToolTip.TipText.textWidth;
      ToolTip.TipBackground._width = ToolTip.TipText.textWidth+8;
      }
      // hide tip
      function CloseTip() {
      Mouse.removeListener(TipMover);
      ToolTip._alpha = 0;
      ToolTip.TipText.text = "";
      }
      this.onRollOut = this.onDragOut=function () {
      hide();
      };

      and here is the code for each dot, which is a button

      // code from on a button
      on(rollOver)
      {
      _root.DisplayTip("Sacramento, CA 1234 pat Blvd. Sacarment CA 12345 1-800-222-2345");

      }
      on(rollOut)
      {
      _root.CloseTip();
      }


      any help would be greatly appreciated. thank you.