flex自定义ToolTip

其实也是官方例子
<?xml version="1.0"?>
<!-- tooltips/ToolTipComponents/PanelToolTip.mxml (tos.mxml)-->
<mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml" 
    implements="mx.core.IToolTip" 
    width="200" 
    alpha=".8" 
    borderThickness="2"
    backgroundColor="0xCCCCCC"
    dropShadowEnabled="true" 
    borderColor="black"
    borderStyle="solid"
    title="feh"
>
    <mx:Script><![CDATA[
        import mx.controls.*;
        [Bindable]
        public var bodyText:String = "";
<?xml version="1.0"?>
<!-- tooltips/MainCustomApp.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script><![CDATA[
        //import ToolTipComponents.PanelToolTip;
        import mx.events.ToolTipEvent;
        
        private function createCustomTip(title:String, body:String, event:ToolTipEvent):void {
           var ptt:tos= new tos();
           ptt.title = title;
           ptt.bodyText = body;
           event.toolTip = ptt;
        }
    ]]></mx:Script>
    
    <mx:Button id="b1" 
        label="Delete" 
        toolTip=" " 
        toolTipCreate="createCustomTip('DELETE','Click this button to delete the report.', event)"
    /> 

    <mx:Button id="b2" 
        label="Generate" 
        toolTip=" " 
        toolTipCreate="createCustomTip('GENERATE','Click this button to generate the report.', event)"
    /> 
    
    <mx:Button id="b3"
        label="Stop"
        toolTip="Click this button to stop the creation of the report. This button uses a standard ToolTip style."
    />

</mx:Application>
         
        //  Implement required methods of the IToolTip interface; these 
        //  methods are not used in this example, though.
        public var _text:String;

        public function get text():String { 
            return _text; 
        } 
        public function set text(value:String):void {
	this._text=value;
	Alert.show("toolTip");
	
        } 
    ]]></mx:Script>
    <mx:Button label="test"/>
    <mx:Text text="{bodyText}" percentWidth="100"/>

</mx:Panel>

 

你可能感兴趣的:(xml,Flex,Adobe)