Flex中如何通过doubleClickEnabled属性,监听按钮doubleClick事件

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white">
 
    <mx:Script>
        <![CDATA[
            private function btn_click(evt:MouseEvent):void {
                appendText(evt.type);
            }
 
            private function btn_doubleClick(evt:MouseEvent):void {
                appendText(evt.type);
            }
 
            private function appendText(str:String):void {
                var now:Date = new Date();
                textArea1.text += "[" + now.toTimeString() + "] " + str + "\n";
                textArea1.validateNow();
                textArea1.verticalScrollPosition = textArea1.maxVerticalScrollPosition;
            }
        ]]>
    </mx:Script>
 
    <mx:ApplicationControlBar dock="true">
        <mx:Form>
            <mx:FormItem label="开启双击事件:">
                <mx:CheckBox id="checkBox"  selected="true" />
                <mx:Button id="button"
                        label="请双击,一定会先触发单击事件"
                        doubleClickEnabled="{checkBox.selected}"
                        click="btn_click(event);"
                        doubleClick="btn_doubleClick(event);" />
            </mx:FormItem>
           
        </mx:Form>
    </mx:ApplicationControlBar>
 
    <mx:TextArea id="textArea1"
            editable="false"
            width="100%"
            height="100%" />
 
</mx:Application>

原文:http://favzone.com/article.asp?id=37

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