AS3:
myUIComponent.doubleClickEnabled=true;
myUIComponent.addEventListener(MouseEvent.DOUBLE_CLICK, dblClickHandler);

MXML
<mx:Button label="MXML DblClick Event" doubleClickEnabled="true" 
doubleClick="dblClickHandler(event)"/>

EXAMPLE:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
        creationComplete="initApp()">

        <mx:Script>
                <![CDATA[
                        import mx.controls.Alert;
                        import flash.events.MouseEvent;
                        
                        private function initApp():void
                        {
                                dblClickBtn.doubleClickEnabled=true;
                                
dblClickBtn.addEventListener(MouseEvent.DOUBLE_CLICK, dblClickHandler);
                        }
                        private function dblClickHandler(evtObj:MouseEvent):void
                        {
                                Alert.show('Double Clicked!', 'Alert Box', 
mx.controls.Alert.OK);
                        }
                ]]>
        </mx:Script>

        <mx:Button label="MXML DblClick Event"
                doubleClickEnabled="true"
                doubleClick="dblClickHandler(event)"/>
                
        <mx:Button id="dblClickBtn" label="AS DblClick Event" />
        
</mx:Application>


_______________________________________________________________

Joseph Balderson, Flash Platform Developer | http://joeflash.ca
Abobe Certified Developer & Trainer | 705-466-6345
Writing partner, Community MX | http://www.communitymx.com


lampei wrote:
> I don't think there's an actual event that will do it, but you could 
> write your own.  Something like:
> 
> When the mousedown event fires, set a variable with a date.
> When the user clicks again make sure a minimum amount of time has passed 
> (and also make sure it's less than a certain max time you determine).  
> If the second click of the button falls within your pre-defined range, 
> fire off the double-click event, else, set the variable to new Date and 
> wait for another click.
> 
> --- In [email protected], "flexawesome" <[EMAIL PROTECTED]> wrote:
>  >
>  > Hey there,
>  >
>  > I have a button and would like to detect DoubleClick event. Is that
>  > possible?
>  >
>  > Thanks a lot
>  >
> 

Reply via email to