Simple Tool Tip using action script 2

1. Create a new flash file and save it as tooltip.fla

2. Create a movie clip named as ‘tooltip_mc’ and move it on stage.

3. Set the instance name as same ‘tooltip_mc’ for the movie clip

4. Copy the below actionscript coding in first frame of layer 1

MovieClip.prototype.toolTip = function(msg:String) {
this.onRollOver = function() {
timer = setInterval(showTip, 500);
theObject = this._name.toString();
function showTip() {
clearInterval(timer);
_root.createTextField(“toolTip”, 1000, _root._xmouse+10, _root._ymouse-30, 10, 10);
_root.toolTip.autoSize = true;
_root.toolTip.border = true;
_root.toolTip.background = true;
_root.toolTip.backgroundColor = 0xFFFFC9;
var myformat:TextFormat = new TextFormat();
myformat.font = “Arial”;
myformat.size = 10;
_root.toolTip.text = msg;
_root.toolTip.setTextFormat(myformat);
onEnterFrame = function () {
_root.toolTip._x = _root._xmouse+10;
_root.toolTip._y = _root._ymouse-30;
};
}
};
this.onRollOut = function() {
_root.toolTip.removeTextField();
clearInterval(timer);
};
};

tooltip_mc.toolTip(“Tool Tip for \nbutton”);

Check the source file as attachment.

admin

Back to top