Implementing the IToolTip interface

You can also create a custom ToolTip by extending an existing control, such as a Panel or other container, and implementing the IToolTip interface. The following example uses a Panel container as the base for a new implementation of the IToolTip interface:



 1 <?xml version="1.0"?>
 2 <!-- tooltips/ToolTipComponents/PanelToolTip.mxml -->
 3 <s:Panel 
 4     xmlns:fx="http://ns.adobe.com/mxml/2009"    
 5     xmlns:mx="library://ns.adobe.com/flex/mx"     
 6     xmlns:s="library://ns.adobe.com/flex/spark"
 7     implements="mx.core.IToolTip" 
 8     width="200" 
 9     alpha=".75">
10     <fx:Script>
11         <![CDATA[
12             [Bindable]
13             public var bodyText:String = "";
14 
15             //  Implement required methods of the IToolTip interface; these 
16             //  methods are not used in this example, though.
17             public var _text:String;
18 
19             public function get text():String { 
20                 return _text; 
21             } 
22             public function set text(value:String):void {
23             } 
24         ]]>
25     </fx:Script>
26 
27     <s:RichText text="{bodyText}" percentWidth="100"/>
28 
29 </s:Panel>

相关文章:

  • 2021-07-06
  • 2021-07-02
  • 2022-12-23
  • 2021-10-10
  • 2022-12-23
  • 2022-02-08
  • 2021-05-27
  • 2021-10-12
猜你喜欢
  • 2021-10-22
  • 2022-12-23
  • 2021-11-13
  • 2022-12-23
  • 2021-11-22
  • 2021-11-11
相关资源
相似解决方案