Button Tooltip - Page 2
Posted by : webzo on Mar 21, 2008
Code Explanation[/st]
btn1.onRollOut = btn2.onRollOut = btn3.onRollOut = function()
{
_root.Tooltip._visible = false;
clearInterval(tooltipTimer);
}
This code sets an interval that calls the function "showTooltip" every 1000 milliseconds with the parameter "This is Button 1".
setInterval(function name, milliseconds, parameters for the function); The third parameter for setInterval is optional.
Every setInterval returns an unique ID and this ID number is need if we want to stop calling the function "showTooltip".
That's why we used "tooltipTimer = ...;".
btn1.onRollOver = function()
{
tooltipTimer = setInterval(showTooltip, 1000, "This is Button 1");
}
On the RollOut event of all button set the visibility of the tooltip to false and use the function clearInterval to stop calling "showTooltip". clearInterval(ID number);
function showTooltip(tip)
{
_root.Tooltip._visible = true;
Make Tooltip visible.
_root.Tooltip._x = _xmouse;
_root.Tooltip._y = _ymouse;
Set Tooltip position.
_root.Tooltip.tip.text = tip;
}
Set text for the tooltip.
That's the end of the tutorial. Happy coding!

1 comment
Add comment
basilrath
what does
"Go back to the main timeline and drag an instance of the Tooltip Movie Clip with the name "Tooltip".
and how do i do that ......... sorry im new to this :)
a video would be cool if poss
#  /  PM  /  posted on Mar 01, 2011