The click/doubleClick behavior is generally considered “correct” as it’s the same as Windows behavior.  If you want to know if only a click occurred you should store a variable and use a timer, when the timer fires check to see if doubleClick had fired and if not then execute on your click.  Doesn’t have to be a long timer but long enough that another click would be considered a regular click.

 

doubleClick on the label may be a known bug.

 

Matt


From: [email protected] [mailto:[email protected]] On Behalf Of Tobias Patton
Sent: Tuesday, April 04, 2006 10:17 AM
To: [email protected]
Subject: [flexcoders] Flex 2b2: Double click troubles

 

Hello List;

 

I have a couple questions/problems with double click events.

 

  1. When the user double-clicks an object, two events are fired. The first click fires a Click event. The second click fires a DoubleClick event. This is problematic when a control needs to implement different behaviors for click and double-click. Whenever the user double-clicks, the click handler is invoked before the double-click handler. How can the click handler know it should ignore the event because it’s actually part of a double-click event.

 

  1. Label controls don’t seem to every get a DoubleClick event. Even when the doubleClickEnabled property is set to “true” for the entire containment hierarchy. Is this a bug?

 

Here’s the application I’m using to test click and double click events:

 

<?xml version="1.0" encoding="utf-8"?>

<mx:Application

            xmlns:mx="http://www.adobe.com/2006/mxml"

            xmlns="*"

            layout="absolute"

            doubleClickEnabled="true"

            creationComplete="OnCreationComplete()">

           

            <mx:Script>

                        <![CDATA[

                                    private function OnCreationComplete() : void

                                    {

                                                trace( "Label doubleClickEnabled:", l1.doubleClickEnabled );

                                                trace( "Button doubleClickEnabled:", b1.doubleClickEnabled );

                                    }

                        ]]>

            </mx:Script>

           

            <mx:HBox>

                       

                        <mx:Label id="l1"

                                                text="ClickMe"

                                                doubleClickEnabled="true"

                                                click="trace( 'Label Click' )"

                                                doubleClick="trace( 'Label DoubleClick' )"/>

                                   

                                    <mx:Button id="b1"

                                                label="ClickMe"

                                                doubleClickEnabled="true"

                                                click="trace( 'Button Click' )"

                                                doubleClick="trace( 'Button DoubleClick' )"/>

                       

            </mx:HBox>

</mx:Application>

 

Creo Inc., a subsidiary of Kodak

Tobias Patton | Software Developer | Tel: +1.604.451.2700 ext: 5148 | mailto:[EMAIL PROTECTED] | http://www.creo.com

 




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




YAHOO! GROUPS LINKS




Reply via email to