DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Tooltip
// description of your code here
this.attachMovie("tooltip","tooltip_mc",21);
tooltip_mc._visible = false;
var tipInt; //----start or clear an interval---
button.onRollOver = function() {
tipInt = setInterval (showTip,100,"button");
//-----showTip function, 10 times a second, to the "button" string(which is the text for the tooltip)------
if(success) {
trace(success)
}
};
button.onRollOut = function() {
hideTip();
};
var count = 0; //-----this variable will count how long it takes to load the tip---
//--------tiptext is the instance name of the text in the tip--------
function showTip(tiptext) {
if(count == 1) {
clearInterval(tipInt);
count = 0;
tooltip_mc.tiptext.text = tiptext;
tooltip_mc._x = _root._xmouse;
tooltip_mc._y = _root._ymouse;
tooltip_mc._visible = true;
_root.onMouseMove = function() {
tooltip_mc._x = _root._xmouse;
tooltip_mc._y = _root._ymouse;
updateAfterEvent(); //-----updates position even in same frame
}
}
else {
count++;
}
};
function hideTip() {
clearInterval(tipInt);
tooltip_mc._visible = false;
delete _root.onMouseMove;
};





