Flex double click behavior

When using the double click permission on any component, sometimes I am unable to activate the double click.

I figured out that if I switch between fast single click it will NEVER fire the double click event. If, however, I do not move the mouse between clicks, then a double click is performed.

I am considering using a timer to get my double click.

How would you solve this?

Example

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" applicationComplete="init()">
    <mx:Canvas id="bg" width="100%" height="100%" backgroundColor="white" />

     <mx:Script>
        <![CDATA[

            private function init():void {

            var cvstest:Canvas = new Canvas();
            cvstest.width = 200;
            cvstest.height = 200;
            cvstest.x = 100;
            cvstest.doubleClickEnabled = true;
            cvstest.addEventListener(MouseEvent.DOUBLE_CLICK, dc);
            cvstest.addEventListener(MouseEvent.MOUSE_DOWN, md);
            cvstest.setStyle("backgroundColor",0xff0000);
            this.addChild(cvstest);   



            }

         public function dc (e:MouseEvent) : void {
            trace("DOUBLE CLICK ON TEST CANVAS");
        } 
         public function md (e:MouseEvent) : void {
            trace("SINCLICK ON TEST CANVAS");
        } 

        ]]>    
    </mx:Script>
</mx:Application>

      

0


a source to share


2 answers


Your code works fine on my trackpad, but I guess it's because it's very difficult to move the mouse between clicks.

If I use my wacom, it seems to me that my double click will only succeed for 1/3 of the time.



There's also: http://bugs.adobe.com/jira/browse/FP-15 : (

+1


a source


I can fix this problem by clearing classInterval

and invoking deferred check.



0


a source







All Articles