Groups | Blog | Home
all groups > flash actionscript > october 2007 >

flash actionscript : hover captions



ltdesign1
10/25/2007 10:24:17 PM
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
kglad
10/25/2007 10:31:45 PM
ltdesign1
10/25/2007 10:41:36 PM
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
10/26/2007 1:09:56 AM
AddThis Social Bookmark Button