- 浏览: 420502 次
- 性别:
- 来自: 济南
-
最新评论
-
nianshi:
slideDown就是show的滑动效果版本, slideUp ...
Jquery零碎代码收藏 -
nianshi:
以后编写JS代码,少写<div onclick=&quo ...
Jquery零碎代码收藏 -
nianshi:
获取匹配元素相对父元素的偏移var p = $("p ...
Jquery零碎代码收藏 -
nianshi:
获取匹配元素在当前窗口的相对偏移var p = $(" ...
Jquery零碎代码收藏 -
wuchu:
谢谢
Flex 读取XML配置文件总结
package
1. {
2. import mx.core.UIComponent;
3.
4. {
5.
6. import flash.accessibility.AccessibilityProperties;
7. import flash.display.*;
8. import flash.events.*;
9. import flash.geom.Point;
10. import flash.text.*;
11.
12. /**
13. * @link kinglong@gmail.com
14. * @author Kinglong
15. * @version 0.1
16. * @since 20090608
17. * @playerversion fp9+
18. * 热区提示
19. */
20. public class ToolTip extends UIComponent{
21. private static var instance:ToolTip = null;
22. private var label:TextField;
23. private var area:DisplayObject;
24. public function ToolTip() {
25.
26. label = new TextField();
27. label.autoSize = TextFieldAutoSize.LEFT;
28. label.selectable = false;
29. label.multiline = false;
30. label.wordWrap = false;
31. label.defaultTextFormat = new TextFormat("宋体", 12, 0x666666);
32. label.text = "提示信息";
33. label.x = 5;
34. label.y = 2;
35. addChild(label);
36. redraw();
37. visible = false;
38. mouseEnabled = mouseChildren = false;
39. }
40.
41. private function redraw() {
42. var w:Number = 10 + label.width;
43. var h:Number = 4 + label.height;
44. this.graphics.clear();
45. this.graphics.beginFill(0x000000, 0.4);
46. this.graphics.drawRoundRect(3, 3, w, h, 5, 5);
47. this.graphics.moveTo(6, 3 + h);
48. this.graphics.lineTo(12, 3 + h);
49. this.graphics.lineTo(9, 8 + h);
50. this.graphics.lineTo(6, 3 + h);
51. this.graphics.endFill();
52. this.graphics.beginFill(0xffffff);
53. this.graphics.drawRoundRect(0, 0, w, h, 5, 5);
54. this.graphics.moveTo(3, h);
55. this.graphics.lineTo(9, h);
56. this.graphics.lineTo(6, 5 + h);
57. this.graphics.lineTo(3, h);
58. this.graphics.endFill();
59. }
60.
61. public static function init(base:DisplayObjectContainer) {
62. if (instance == null) {
63. instance = new ToolTip();
64. base.addChild(instance);
65. }
66. }
67.
68. public static function register(area:DisplayObject, message:String):void {
69. if(instance != null){
70. var prop:AccessibilityProperties = new AccessibilityProperties();
71. prop.description = message;
72. area.accessibilityProperties = prop;
73. area.addEventListener(MouseEvent.MOUSE_OVER, instance.handler);
74. }
75. }
76.
77. public static function unregister(area:DisplayObject):void {
78. if (instance != null) {
79. area.removeEventListener(MouseEvent.MOUSE_OVER, instance.handler);
80. }
81. }
82.
83. public function show(area:DisplayObject):void {
84. this.area = area;
85. this.area.addEventListener(MouseEvent.MOUSE_OUT, this.handler);
86. this.area.addEventListener(MouseEvent.MOUSE_MOVE, this.handler);
87. label.text = area.accessibilityProperties.description;
88. redraw();
89. }
90.
91.
92. public function hide():void {
93. this.area.removeEventListener(MouseEvent.MOUSE_OUT, this.handler);
94. this.area.removeEventListener(MouseEvent.MOUSE_MOVE, this.handler);
95. this.area = null;
96. visible = false;
97. }
98.
99. public function moves(point:Point):void {
100. var lp:Point = this.parent.globalToLocal(point);
101. this.x = lp.x - 6;
102. this.y = lp.y - label.height - 12;
103. if(!visible){
104. visible = true;
105. }
106. }
107.
108. private function handler(event:MouseEvent):void {
109. switch(event.type) {
110. case MouseEvent.MOUSE_OUT:
111. this.hide();
112. break;
113. case MouseEvent.MOUSE_MOVE:
114. this.moves(new Point(event.stageX, event.stageY));
115. break;
116. case MouseEvent.MOUSE_OVER:
117. this.show(event.target as DisplayObject);
118. this.moves(new Point(event.stageX, event.stageY))
119. break;
120. }
121. }
122.
123. }
124.
125. }
126. }
package { import mx.core.UIComponent; { import flash.accessibility.AccessibilityProperties; import flash.display.*; import flash.events.*; import flash.geom.Point; import flash.text.*; /** * @link kinglong@gmail.com * @author Kinglong * @version 0.1 * @since 20090608 * @playerversion fp9+ * 热区提示 */ public class ToolTip extends UIComponent{ private static var instance:ToolTip = null; private var label:TextField; private var area:DisplayObject; public function ToolTip() { label = new TextField(); label.autoSize = TextFieldAutoSize.LEFT; label.selectable = false; label.multiline = false; label.wordWrap = false; label.defaultTextFormat = new TextFormat("宋体", 12, 0x666666); label.text = "提示信息"; label.x = 5; label.y = 2; addChild(label); redraw(); visible = false; mouseEnabled = mouseChildren = false; } private function redraw() { var w:Number = 10 + label.width; var h:Number = 4 + label.height; this.graphics.clear(); this.graphics.beginFill(0x000000, 0.4); this.graphics.drawRoundRect(3, 3, w, h, 5, 5); this.graphics.moveTo(6, 3 + h); this.graphics.lineTo(12, 3 + h); this.graphics.lineTo(9, 8 + h); this.graphics.lineTo(6, 3 + h); this.graphics.endFill(); this.graphics.beginFill(0xffffff); this.graphics.drawRoundRect(0, 0, w, h, 5, 5); this.graphics.moveTo(3, h); this.graphics.lineTo(9, h); this.graphics.lineTo(6, 5 + h); this.graphics.lineTo(3, h); this.graphics.endFill(); } public static function init(base:DisplayObjectContainer) { if (instance == null) { instance = new ToolTip(); base.addChild(instance); } } public static function register(area:DisplayObject, message:String):void { if(instance != null){ var prop:AccessibilityProperties = new AccessibilityProperties(); prop.description = message; area.accessibilityProperties = prop; area.addEventListener(MouseEvent.MOUSE_OVER, instance.handler); } } public static function unregister(area:DisplayObject):void { if (instance != null) { area.removeEventListener(MouseEvent.MOUSE_OVER, instance.handler); } } public function show(area:DisplayObject):void { this.area = area; this.area.addEventListener(MouseEvent.MOUSE_OUT, this.handler); this.area.addEventListener(MouseEvent.MOUSE_MOVE, this.handler); label.text = area.accessibilityProperties.description; redraw(); } public function hide():void { this.area.removeEventListener(MouseEvent.MOUSE_OUT, this.handler); this.area.removeEventListener(MouseEvent.MOUSE_MOVE, this.handler); this.area = null; visible = false; } public function moves(point:Point):void { var lp:Point = this.parent.globalToLocal(point); this.x = lp.x - 6; this.y = lp.y - label.height - 12; if(!visible){ visible = true; } } private function handler(event:MouseEvent):void { switch(event.type) { case MouseEvent.MOUSE_OUT: this.hide(); break; case MouseEvent.MOUSE_MOVE: this.moves(new Point(event.stageX, event.stageY)); break; case MouseEvent.MOUSE_OVER: this.show(event.target as DisplayObject); this.moves(new Point(event.stageX, event.stageY)) break; } } } } }
测试代码:
view plaincopy to clipboardprint?
0. <?xml version="1.0" encoding="utf-8"?>
1. <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
2.
3. <mx:Script>
4. <!--[CDATA[
5.
6. private function init():void{
7.
8. ToolTip.init(this);
9. //与显示元素关联。
10. ToolTip.register(checkBox, "http://www.klstudio.com");
11. ToolTip.register(button, "我是按钮1");
12. ToolTip.register(img, "我是图片!");
13.
14.
15. }
16.
17.
18. ]]-->
19. </mx:Script>
20. <mx:Button id="button" x="211" y="117" label="Button"/>
21. <mx:CheckBox id="checkBox" x="156" y="289" label="Checkbox"/>
22.
23. <mx:TextArea id="img" x="183" y="498"/>
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()"> <mx:Script> <!--[CDATA[ private function init():void{ ToolTip.init(this); //与显示元素关联。 ToolTip.register(checkBox, "http://www.klstudio.com"); ToolTip.register(button, "我是按钮1"); ToolTip.register(img, "我是图片!"); } ]]--> </mx:Script> <mx:Button id="button" x="211" y="117" label="Button"/> <mx:CheckBox id="checkBox" x="156" y="289" label="Checkbox"/> <mx:TextArea id="img" x="183" y="498"/>
我只是在原作者代码的基础上做了此许改动,修改后可以直接在flex中的mxml中使用
源地址:http://www.klstudio.com/post/198.html
发表评论
-
Flex小记录
2011-02-24 10:18 1306Flex读取XML: <mx:HTTPServic ... -
flex实现滑动显示隐藏效果
2010-12-30 15:30 1616鼠标划过的时候显示菜单栏 ,鼠标移开后隐藏菜单栏。比较常用 ... -
flex DataTimePicker时间控件
2010-12-27 11:54 1327两种DatatimePicker: 1.Datatim ... -
ActionScript 生成伪Guid
2010-12-24 09:52 1222在一个Flash制作的图片上传程序中(使用了FileRefer ... -
Flex中Image组件怎么才能非等比例拉伸图片
2010-12-23 15:49 1521Image组件怎么才能非等比例拉伸图片 设 ... -
Flex中Accordion用法
2010-12-23 11:45 3092<? xml version = & ... -
Flex(替代session过期)实现用户长时间不操作要求重新登录的处理
2010-12-23 11:08 1515flex(替代session过期)用户长时间不操作要求重新登录 ... -
ActionScript 3.0 Socket编程
2010-12-23 09:56 1188在使用ActionScript3.0进行编程 ... -
12个简单易用的flex函数
2010-12-21 10:10 11541.拷贝内容到剪贴板: ... -
Flex自定义控件——Pagebar分页控件
2010-12-20 09:41 5278开发时经常遇到用一个DataGrid分页显示 ... -
Flex资源,很全,很牛!
2010-12-20 09:30 14731、as3ebaylib http://code ... -
Flex 窗体 最大化、最小化实例
2010-12-20 09:28 2727---导入flexMdi.swc (http ... -
在Flex中复制文字到操作系统的剪贴板
2010-12-15 11:18 1254这个实例演示了怎么样使用System. ... -
Flex让Slider控件拖动时显示Tooltip
2010-12-14 16:10 1925格式化与自定义Slider中显示的Tooltip ... -
Flex给Alert加个Icon
2010-12-14 16:05 1292给Alert加个Icon 很简单只要先 Embed 一 ... -
在Flex中用Validator验证数字、字符串、Email、电话号码等
2010-12-14 09:54 4334mx.validators ... -
Flex中使用FileReference类下载文件
2010-12-14 09:47 1804下面的实例演示了Flex中的 File ... -
Flex使用ArrayCollection的filterFunction属性过滤DataGrid
2010-12-14 09:42 1818下面的实例演示了在Flex中怎样使用 ... -
Flex 树形控件(Tree )的使用
2010-12-13 16:24 3484一、树形控件的常用属性 1、dragMoveE ... -
FLEX3中应用CSS完全详解手册(下)
2010-12-13 11:40 891myTabs中的设置 cornerRadiusTab ...
相关推荐
标题中的“flex tooltip”指的是Adobe Flex中的一种交互设计元素,Tooltip。在Flex应用程序开发中,Tooltip是用来显示鼠标悬停在某个组件上时提供额外信息的小型弹出窗口。它可以帮助用户理解控件的功能或者显示一些...
在flex中,可以使用`mx.controls.ToolTip`类来创建和管理`ToolTip`。首先,你需要在MXML代码中定义一个`ToolTip`实例,并为其设置相应的属性,如`id`、`content`(显示的文本)和`delay`(显示`ToolTip`前的延迟...
### Flex自定义ToolTip详解 在Flex开发中,`ToolTip`是一种非常实用的界面元素,用于在用户悬停或聚焦某个控件时显示额外的信息。默认情况下,Flex提供了基本的`ToolTip`功能,但有时为了满足特定的设计需求或者...
1. **Tooltip类定义**:定义一个Tooltip类,可能继承自系统提供的基础Tooltip类,或者完全自定义实现。这个类应该包含必要的属性(如Tooltip文本)和方法(如显示、隐藏、设置文本等)。 2. **关联控件**:类中可能...
在标题提到的"VC 简洁的tooltip提示类"中,我们可以理解为这是一个专门为VC++开发的自定义类,用于增强或简化对控件(如static、Edit、Button等)添加Tooltip提示的过程。 Tooltip提示通常用于提供额外的信息,当...
在ActionScript 3 (AS3)中,ToolTip 类是一个用于创建和管理鼠标悬停提示的内置组件。这个类使得开发者可以自定义显示在鼠标指针附近的文本或图形提示,为用户提供更多的上下文信息。在本篇文章中,我们将深入探讨...
1. 创建新的ToolTip类:继承自Adobe Flex的基础ToolTip类,或者使用IFeedback接口来创建自定义反馈组件。 2. 配置显示内容:根据需求,可以将内容动态生成,也可以预先设定,如使用数据绑定将单元格数据与ToolTip...
简单 ToolTip 类,可以设置显示位置,自己控制显示或隐藏。
标题“MFC_ToolTip超级类”指的是一个专门扩展了MFC原生`CToolTipCtrl`类的自定义类,以实现更丰富的功能,比如创建不同类型的ToolTip。 `ToolTip`控件通常用来提供关于用户界面上各个控件的额外信息,当鼠标悬停在...
标题中的“能够实现多行显示tooltip的类”指的是在编程中创建的一种自定义控件,它扩展了标准的tooltip功能,使其支持显示多行文本。通常,系统默认的tooltip只支持单行显示,但在这个情况下,开发人员可能已经编写...
标题“MFC中的tooltip的类”指的是利用MFC来实现这一功能的相关类和方法。虽然Tooltip在实际应用中非常常见,但对于初学者来说,理解并正确使用它们可能会有些复杂。 首先,我们要了解MFC中的Tooltip类`...
在描述中提到的“一个tooltip类,表示一个长方形的小弹出窗口”,实际上就是在创建一个自定义的Tooltip类,以便在用户将鼠标悬停在特定的舞台对象(如按钮或图形)上时显示相关信息。 创建自定义Tooltip类的步骤...
- `CToolTipCtrl`类提供了多种方法来定制ToolTip的外观和行为,如`SetTipBkColor`和`SetTipTextColor`可以改变提示背景和文字颜色。 - `SetMaxTipWidth`可以设置最大宽度,`SetDelayTime`可以调整显示和消失的延迟...
实现带有tooltip的ClistCtrl类,我们需要完成以下步骤: 1. **创建自定义ClistCtrl类**: 首先,我们需要创建一个继承自ClistCtrl的自定义类,例如CToolTipListCtrl。在这个新类中,我们将重写一些必要的成员函数...
易语言模块Tooltip272Alpha版.rar 易语言模块Tooltip272Alpha版.rar 易语言模块Tooltip272Alpha版.rar 易语言模块Tooltip272Alpha版.rar 易语言模块Tooltip272Alpha版.rar 易语言模块Tooltip272Alpha版.rar
易语言模块Tooltip30版[易语言3.0以上版本].rar 易语言模块Tooltip30版[易语言3.0以上版本].rar 易语言模块Tooltip30版[易语言3.0以上版本].rar 易语言模块Tooltip30版[易语言3.0以上版本].rar 易语言模块...
在VB(Visual Basic)编程环境中,创建自定义的ToolTip类是一项常见的需求,特别是在设计用户界面时,为了提供更丰富的交互体验。"VB ToolTip气泡提示类"是针对这一需求的解决方案,它允许开发者实现多行显示、...
文件名为"InfoBar",这可能是指控件的一个组件或者特定的类,比如一种信息展示栏,可能与tooltip控件有关,用于展示更详细的信息,或者作为tooltip的一种扩展形式。 **详细知识点** 1. **Tooltip基础概念**:...
MFC库则提供了更面向对象的方法来处理TOOLTIP,如`CToolTipCtrl`类。在MFC中,你可以通过以下步骤实现TOOLTIP: 1. **创建CToolTipCtrl对象**: 在你的视图或对话框类中创建一个`CToolTipCtrl`对象,并在构造函数中...