Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You probably did the right thing but the datagrid do not handle very well the click and double click, you can use a workaround to do that:</p> <p>first the datagrid properties: </p> <pre><code>&lt;s:DataGrid dataProvider="{lista}" click="click(event)" doubleClickEnabled="true" doubleClick="doubleClick(event)"&gt; </code></pre> <p>then the click handler start a timer and if the timer successfully terminate the single click event is dispatched, otherwise if you double click the timer is stopped and you handle the double click event... </p> <p>An example is better than anything else...</p> <pre><code>// A timer used to check if is a single or doubleclick private var t:Timer; protected function click(event:MouseEvent):void { // on single click you start a timer, the dalay // is 500 but you can set what you prefer t = new Timer(500,1); t.addEventListener(TimerEvent.TIMER_COMPLETE, singleClick); t.start(); } protected function singleClick(e:TimerEvent):void { // if the timer complete correctly this method is called and // here you manage the single click event t.removeEventListener(TimerEvent.TIMER_COMPLETE,singleClick); trace("single click"); } protected function doubleClick(event:MouseEvent):void { // on double click you remove the timer event listener and you stop it if it's running // here you manage the double click event... t.removeEventListener(TimerEvent.TIMER_COMPLETE,singleClick); if (t.running) t.stop(); trace("double click"); } </code></pre> <p>Hope this helps...</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload