这几天csdn的blog又出问题了, 唉. 今天去买个域名, 尽快解决这些事情.
推荐小贝的ToolTip组件下载: http://f358.com/blog/koaqiu/articles/223.html
再来一个!! 张俊钦朋友的ToolTip
class ToolTip { private static var tipHoldMC:MovieClip; private static var myTextFormat:TextFormat; private static var msg:String; public static function setToolTip(target:MovieClip, dummyMsg:String):Void { target.onRollOver = function() { msg = dummyMsg; tipHoldMC = target._parent.createEmptyMovieClip("dummMC", 1000); tipHoldMC.createTextField("tipTxt", 1, 0, 0, 0, 0); tipHoldMC.tipTxt.html = true; tipHoldMC.tipTxt.htmlText = msg; tipHoldMC.tipTxt.selectable = false; tipHoldMC.tipTxt.autoSize = true; tipHoldMC.tipTxt.background = true; tipHoldMC.tipTxt.border = true; tipHoldMC.tipTxt.borderColor = 0x000000; tipHoldMC.tipTxt.backgroundColor = 0xFFFFEE; with (tipHoldMC) { beginFill(0x999999, 100); moveTo(2, 2); lineTo(tipTxt._width+2, 2); lineTo(tipTxt._width+2, tipTxt._height+2); lineTo(2, tipTxt._height+2); lineTo(2, 2); endFill(); } (target._parent._xmouse+tipHoldMC._width)<Stage.width ? tipHoldMC._x=target._parent._xmouse : tipHoldMC._x=Stage.width-tipHoldMC._width; var boundObject:Object = target.getBounds(target._parent); (boundObject.yMin-target.height-2)>0 ? tipHoldMC._y=boundObject.yMin-target.height-2 : tipHoldMC._y=boundObject.yMax+2; }; target.onRollOut = target.onPress=target.onReleaseOutside=destroyTip; } public static function destroyTip():Void { removeMovieClip(tipHoldMC); } }
效果图: http://www.flash8.net/bbs/UploadFile/2004-11/20041127145553409.swf