2 Replies Latest reply on Nov 28, 2006 9:49 AM by ltdesign1

    Hover captions help

    ltdesign1
      Hi,

      I am having issues with this hover caption script I got from kirupa. Most of the captions work great but some (especially long names) appear way to the left of the button.

      You can see an example here:

      http://qa-scapaosd.migcom.com/Content/10138/east_county.html

      Rollover the bit of land just right of the highway 12 sign in the lower right part of the map for an example of one that appears far left of the rollover hit state.

      I am using the following actionscript:

      captionFN = function (showCaption, captionText, bName) {
      if (showCaption) {
      this.attachMovie("caption", "cap", this.getNextHighestDepth());
      this.createEmptyMovieClip("hoverCaption", this.getNextHighestDepth());
      hoverCaption._alpha
      cap.desc.text = captionText;
      cap._width = 7*cap.desc.text.length;
      cap._alpha = 75;
      //
      if ((bName._width+bName._x+cap._width)>Stage.width) {
      xo = -2-cap._width;
      yo = -17;
      } else {
      xo = 2;
      yo = -17;
      }
      hoverCaption.onEnterFrame = function() {
      cap._x = this._xmouse+xo;
      cap._y = this._ymouse+yo;
      cap._visible = true;
      };
      } else {
      delete hoverCaption.onEnterFrame;
      cap._visible = false;
      }
      };

      Any ideas? I have played around with the x any y values and nothing seems to really change it...
        • 1. Re: Hover captions help
          Level 7
          didn't actually test your code, but my guess is that any of the following
          might solve your problem:
          1) either set the registration point of your 'caption' MC to be in its left
          side (and not in the ceter) - by doing this, hovering over buttons with
          short text will place their caption on the right, and not directly above
          them.
          2) change this line - "xo = -2-cap._width;" to "xo = -2-cap._width/2;"

          good luck,
          eRez

          "ltdesign1" <webforumsuser@macromedia.com> wrote in message
          news:ekfo3i$bib$1@forums.macromedia.com...
          > Hi,
          >
          > I am having issues with this hover caption script I got from kirupa. Most
          > of
          > the captions work great but some (especially long names) appear way to the
          > left
          > of the button.
          >
          > You can see an example here:
          >
          > http://qa-scapaosd.migcom.com/Content/10138/east_county.html
          >
          > Rollover the bit of land just right of the highway 12 sign in the lower
          > right
          > part of the map for an example of one that appears far left of the
          > rollover hit
          > state.
          >
          > I am using the following actionscript:
          >
          > captionFN = function (showCaption, captionText, bName) {
          > if (showCaption) {
          > this.attachMovie("caption", "cap", this.getNextHighestDepth());
          > this.createEmptyMovieClip("hoverCaption", this.getNextHighestDepth());
          > hoverCaption._alpha
          > cap.desc.text = captionText;
          > cap._width = 7*cap.desc.text.length;
          > cap._alpha = 75;
          > //
          > if ((bName._width+bName._x+cap._width)>Stage.width) {
          > xo = -2-cap._width;
          > yo = -17;
          > } else {
          > xo = 2;
          > yo = -17;
          > }
          > hoverCaption.onEnterFrame = function() {
          > cap._x = this._xmouse+xo;
          > cap._y = this._ymouse+yo;
          > cap._visible = true;
          > };
          > } else {
          > delete hoverCaption.onEnterFrame;
          > cap._visible = false;
          > }
          > };
          >
          > Any ideas? I have played around with the x any y values and nothing seems
          > to
          > really change it...
          >


          • 2. Re: Hover captions help
            ltdesign1 Level 1
            Thanks, that did it!!!!!