以下是代码片段: class cls_tooltips { private var tt_target_2s; //目标按钮 private var tt_bgcolor_2s; //背景色 private var tt_bordercolor_2s; //边框色 private var tt_borderthick_2s; //边框粗细 private var tt_borderalpha_2s; //边框透明度 private var tt_fillet_2s; //是否圆角 private var tt_text_2s; //文本 private var tt_width_2s; //宽 private var tt_height_2s; //高 private var tt_angle_2s; //圆角角度 private var tt_dir_2s; //提示位置上下 function cls_tooltips(param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11) { tt_target_2s = param1; tt_fillet_2s = param2; tt_bgcolor_2s = param3; tt_bordercolor_2s = param4; tt_borderthick_2s = param5; tt_borderalpha_2s = param6; tt_text_2s = param7; tt_width_2s = param8; tt_height_2s = param9; tt_angle_2s = param10; tt_dir_2s = param11; tt_draw_2s(); } private function tt_draw_2s() { var temp_fillet = tt_fillet_2s; var temp_bgcolor = tt_bgcolor_2s; var temp_bordercolor = tt_bordercolor_2s; var temp_borderthick = tt_borderthick_2s; var temp_borderalpha = tt_borderalpha_2s; var temp_text = tt_text_2s; var temp_width = tt_width_2s; var temp_height = tt_height_2s; var temp_angle = tt_angle_2s; var temp_dir = tt_dir_2s; tt_target_2s.onRollOver = function() { _root.createEmptyMovieClip("tt_clip_2s", _root.getNextHighestDepth()); with (_root.tt_clip_2s) { _visible = false; lineStyle(temp_borderthick, temp_bordercolor, temp_borderalpha); beginFill(temp_bgcolor); moveTo(0, 0); if (temp_fillet == false) { curveTo(0, 0, temp_width, 0); curveTo(temp_width, 0, temp_width, temp_height); curveTo(temp_width, temp_height, 0, temp_height); curveTo(0, temp_height, 0, 0); } else if (temp_fillet == true) { curveTo(0, -(temp_angle), (2*temp_angle), -(temp_angle)); lineTo((temp_width-(2*temp_angle)), -(temp_angle)); curveTo(temp_width, -(temp_angle), temp_width, 0); lineTo(temp_width, temp_height-temp_angle); curveTo(temp_width, temp_height, (temp_width-(2*temp_angle)), temp_height); lineTo(temp_angle, temp_height); curveTo(0, temp_height, 0, temp_height-temp_angle); } createTextField("tt_text", tt_text.getNextHighestDepth(), 3, 0, 0, 0); tt_text.autoSize = "left"; tt_text.multiline = true; tt_text.html = true; tt_text.htmlText = temp_text; endFill(); this.onEnterFrame = function() { _visible = true; if (temp_dir == false) { _root.tt_clip_2s._x = _root._xmouse+15; _root.tt_clip_2s._y = _root._ymouse+15; } else if (temp_dir == true) { _root.tt_clip_2s._x = _root._xmouse-temp_width-10; _root.tt_clip_2s._y = _root._ymouse-temp_height-10; } }; } }; tt_target_2s.onRollOut = function() { delete this.onEnterFrame; removeMovieClip(_root.tt_clip_2s); }; tt_target_2s.onReleaseOutside = function() { delete this.onEnterFrame; removeMovieClip(_root.tt_clip_2s); }; } } |
用法:
以下是代码片段: _tooltips = new cls_tooltips(MC_bu, true, 0xFF00FF, 0x0000FF, 5, 50, "<u>Hello World!</u><br/><font color=’#CCCCCC’ face=’arial’><b>Nice Day!</b></font><br/>Be Happy!Never Give Up!", 200, 60, 5, false); _tooltips2 = new cls_tooltips(MC_bu2, false, 0xFF00FF, 0x0000FF, 5, 20, "Hello World2!", 200, 40, 0, true); // new cls_tooltips(按钮,是否圆角, 背景颜色, 边框色, 边框粗细,边框透明度 文本, 宽度, 高度, 圆角度,提示位置上下); |
回复Comments
作者:
{commentrecontent}