万卷书   首页 > 电脑书籍 > Flash > 进入Flash MX组件时代之四 组件的衍生
 
//-----------------------------------------------------------------------------

//函 数 名:setTooltip();unsetToolTip();

//功 能:在MovieClip或是Button上显示相应的提示信息

//所需技术:

TextFormat, createTextField, setNewTextFormat, setInterval, clearInterval, removeTextField;

//所需参数:theText,timer,text_color,bg_color,border_color

//适用版本:FlashMX

//自定义函数setTooltip

MovieClip.prototype.setTooltip = function(theText, timer, text_color, bg_color, border_color) {

if (timer == undefined) {

timer = 500;

}

//定义函数addMsg

var addMsg = function (theMsg, col, bg_color, border_color, level) {

var x = _root._xmouse;

var y = _root._ymouse;

//创建文本格式

var f = new TextFormat();

f.font = "宋体";

f.size = 12;

f.color = col != undefined ? col : 0x000000;

//创建动态文本框

_level0.createTextField('tooltip', 123456, x, y, 150, 20);

上一页 下一页