Hi George, This post was part of research into fixing a problem with Event bubbling... See thread: "Stopping double-click of a button 'bubble' to the datagrid row".
Cheers, Nick 2009/9/2 grg_blls <grg_b...@yahoo.com> > > > Hi! > > May I ask why you need a MouseEvent.CLICK and a MouseEvent.DOUBLE_CLICK > event on the same button? Wouldn't that be possible to use a simple > Mouse.CLICK event together with a ctrlKey (or a altKey or shiftKey) pressed? > Just wondering.. > > Thanks > George > > > --- In flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>, Nick > Middleweek <n...@...> wrote: > > > > Beau, > > > > Thanks for this code... I've got another question though, I'll post it as > > another thread... > > > > > > Cheers, > > Nick > > > > > > > > > > 2009/9/1 Beau Scott <beau.sc...@...> > > > > > > > > > > > > The only way I've been able to accomplish this is to use a timer to > filter > > > out a double click, and then ferry the original click event to an > eventual > > > click handler. The downside to this is the hardcoded timer delay > doesn't > > > reflect the user's system's double-click delay, and I'm not sure how to > read > > > that in (I'm not even sure that Flex uses this anyway). > > > > > > Example: > > > > > > <?xml version="1.0" encoding="utf-8"?> > > > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" > > > layout="horizontal" xmlns:local="*"> > > > <mx:Script> > > > <![CDATA[ > > > > > > private var doubleClickFilterTimer:Timer; > > > private var pendingMouseEvent:MouseEvent; > > > > > > private function button_doubClickHandler(event:MouseEvent):void > > > { > > > if(doubleClickFilterTimer) > > > doubleClickFilterTimer.stop(); > > > trace('double clicked'); > > > } > > > > > > private function button_clickHandler(event:MouseEvent):void > > > { > > > if(!doubleClickFilterTimer) > > > { > > > doubleClickFilterTimer = new Timer(200, 1); > > > > > > doubleClickFilterTimer.addEventListener(TimerEvent.TIMER_COMPLETE, > > > doubleClickFilterTimer_timerCompleteHandler); > > > } > > > else > > > { > > > doubleClickFilterTimer.reset(); > > > } > > > pendingMouseEvent = event; > > > doubleClickFilterTimer.start(); > > > } > > > > > > private function > > > doubleClickFilterTimer_timerCompleteHandler(event:TimerEvent):void > > > { > > > finishClickHandler(pendingMouseEvent); > > > pendingMouseEvent = null; > > > } > > > > > > private function finishClickHandler(event:MouseEvent):void > > > { > > > trace('clicked'); > > > } > > > ]]> > > > </mx:Script> > > > > > > <mx:Button label="Click or Double-Click Me" > > > click="button_clickHandler(event)" > > > doubleClickEnabled="true" > > > doubleClick="button_doubClickHandler(event)" /> > > > > > > </mx:Application> > > > > > > > > > > > > Hope that helps, > > > > > > Beau > > > > > > > > > On Tue, Sep 1, 2009 at 9:27 AM, Nick Middleweek <n...@...>wrote: > > > > > >> > > >> > > >> Hello, > > >> > > >> I'm having difficulty setting both a click and a doubleClick event on > the > > >> same button. Is it possible? > > >> > > >> > > >> Thanks, > > >> Nick > > >> > > >> > > > > > > > > > -- > > > Beau D. Scott > > > Software Engineer > > > > > > > > > > >