日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

简单纯文字浮动信息-Tooltip

發(fā)布時間:2023/12/20 编程问答 36 豆豆
生活随笔 收集整理的這篇文章主要介紹了 简单纯文字浮动信息-Tooltip 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

分享個AS3 ToolTip類 純文本

效果預(yù)覽:

package ui {import flash.display.*;import flash.events.*;import flash.text.*;public class ToolTip {private static var tips:Array = [];private static var nowShowTip:DisplayObject;public static var isOn:Boolean = true;private static function hideTip(_arg1:MouseEvent):void{var textField:DisplayObjectContainer;textField = (_arg1.currentTarget.root as DisplayObjectContainer);nowShowTip.addEventListener(Event.ENTER_FRAME, alphaHide);}public static function findTip(_arg1:Object):String{var textField:Object;for each (textField in tips) {if (textField[0] == _arg1){return (textField[1]);};};return ("tip");}private static function onOverTip(_arg1:MouseEvent):void {if (isOn == false) return;var textField:TextField;var sp:Sprite;var disContainer:DisplayObjectContainer;textField = new TextField();textField.width = 300;textField.height = 200;textField.textColor = 0xFFFFFF;textField.x = (3 + 4);textField.selectable = false;textField.htmlText = findTip(_arg1.currentTarget);textField.multiline = true;textField.wordWrap = true;textField.width = (textField.textWidth + 17);textField.height = (textField.textHeight + 5);textField.blendMode = BlendMode.LAYER;textField.setTextFormat(new TextFormat("Tahoma,Arial,Verdana"));sp = new Sprite();sp.graphics.beginFill(0x0099FF, 0.45);sp.graphics.lineStyle(1, 0x0099FF);sp.graphics.drawRoundRect(0.5, 0.5, (textField.width + 3), textField.height, 3, 3);sp.addChild(textField);sp.mouseEnabled = false;sp.mouseChildren = false;sp.visible = false;sp.alpha = 0;sp.addEventListener(Event.ENTER_FRAME, alphaShow);sp.cacheAsBitmap = true;disContainer = (_arg1.currentTarget.root as DisplayObjectContainer);disContainer.addChild(sp);nowShowTip = sp;moveTip(_arg1);}private static function alphaShow(_arg1:Event):void{var textField:DisplayObject;textField = (_arg1.currentTarget as DisplayObject);textField.alpha = (textField.alpha + 0.039);textField.visible = true;if (textField.alpha >= 1){textField.removeEventListener(Event.ENTER_FRAME, alphaShow);};}private static function moveTip(_arg1:MouseEvent):void{var textField:DisplayObjectContainer;if (nowShowTip == null){return;};textField = (_arg1.currentTarget.root as DisplayObjectContainer);nowShowTip.x = (textField.mouseX - 1);nowShowTip.y = (textField.mouseY + 22);if (nowShowTip.x > ((textField.stage.stageWidth - nowShowTip.width) - 2)){nowShowTip.x = ((textField.stage.stageWidth - nowShowTip.width) - 2);};if (nowShowTip.y > ((textField.stage.stageHeight - nowShowTip.height) - 2)){nowShowTip.y = ((textField.mouseY - nowShowTip.height) - 5);};}private static function alphaHide(_arg1:Event):void{var textField:DisplayObject;textField = (_arg1.currentTarget as DisplayObject);textField.alpha = (textField.alpha - 0.15);if (textField.alpha < 0.05){textField.removeEventListener(Event.ENTER_FRAME, alphaHide);textField.parent.removeChild(textField);};}public static function addText(_arg1:InteractiveObject, _arg2:String):void{tips.push([_arg1, _arg2]);_arg1.addEventListener(MouseEvent.MOUSE_OVER, onOverTip);_arg1.addEventListener(MouseEvent.MOUSE_OUT, hideTip);_arg1.addEventListener(MouseEvent.MOUSE_MOVE, moveTip);}} }

?

喜歡的可以拿過去哦~

轉(zhuǎn)載于:https://www.cnblogs.com/LLLoveLL/p/3333216.html

總結(jié)

以上是生活随笔為你收集整理的简单纯文字浮动信息-Tooltip的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。