Skip to main content
October 25, 2007
Question

hover captions

  • October 25, 2007
  • 3 replies
  • 267 views
Hello,

I used a tutorial from kirupa to create some hover captions on a grid of buttons. From here:

http://www.kirupa.com/developer/mx2004/hover_captions.htm

It works great but I'd really rather have them appear after a couple seconds of hovering on a button--not instantly. Any ideas on how to accomplish this? I tried messing around with one of the movie clips in the example, putting some static frames at the beginning but that didn't have any affect.

thanks in advance!
Lisa
This topic has been closed for replies.

3 replies

kglad
Community Expert
Community Expert
October 26, 2007
that's as2. in your rollover methods, define a setTimeout() that will trigger a caption to appear after the designated time. in your rollout methods, clear the setTimeout().
October 25, 2007
Sorry, kglad...I don't know if it is as2 or as3. I have pasted the code below...perhaps you can tell which it is written in:


b1.onRollOver = function() {

captionFN(true, "E-Mail!", this);
this.onRollOut = function() {

captionFN(false);

};

};
b2.onRollOver = function() {

captionFN(true, "Portable Devices", this);
this.onRollOut = function() {

captionFN(false);

};

};
b3.onRollOver = function() {

captionFN(true, "Security", this);
this.onRollOut = function() {

captionFN(false);

};

};
b4.onRollOver = function() {

captionFN(true, "Regional Settings", this);
this.onRollOut = function() {

captionFN(false);

};

};
b5.onRollOver = function() {

captionFN(true, "Home Networking", this);
this.onRollOut = function() {

captionFN(false);

};

};
b6.onRollOver = function() {

captionFN(true, "Add/Remove Programs", this);
this.onRollOut = function() {

captionFN(false);

};

};
captionFN = function (showCaption, captionText, bName) {

if (showCaption) {

_root.createEmptyMovieClip("hoverCaption", this.getNextHighestDepth());
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 = _root._xmouse+xo;
cap._y = _root._ymouse+yo;
cap._visible = true;

};

} else {

delete hoverCaption.onEnterFrame;
cap._visible = false;

}

};

kglad
Community Expert
Community Expert
October 25, 2007
as2 or as3?