all groups > flash actionscript > november 2006 >
You're in the

flash actionscript

group:

Hover captions help


Hover captions help ltdesign1
11/27/2006 10:16:18 PM
flash actionscript:
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...
Re: Hover captions help eRez
11/28/2006 12:00:00 AM
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

[quoted text, click to view]

Re: Hover captions help ltdesign1
11/28/2006 5:49:07 PM
AddThis Social Bookmark Button