# Double click event for dataGrid cell?

**URL:** <https://forum.kirupa.com/t/double-click-event-for-datagrid-cell/184205>\
**Category:** Uncategorized\
**Created:** [April 3, 2006, 9:42am UTC](https://forum.kirupa.com/t/double-click-event-for-datagrid-cell/184205 "2006-04-03T09:42:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tiru](https://avatars.discourse-cdn.com/v4/letter/t/74df32/32.png) [@tiru](https://forum.kirupa.com/u/tiru)\
**Post date:** [April 3, 2006, 9:42am UTC](https://forum.kirupa.com/t/double-click-event-for-datagrid-cell/184205/1 "2006-04-03T09:42:52Z")

</div>

hi

Right now iam working on dataGrid component.There is an event for cell press :

```auto

listenerObject = [COLOR=#993300]new[/COLOR] [COLOR=#993300]Object[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
listenerObject.[COLOR=#000000]cellPress[/COLOR] = [COLOR=#993300]function[/COLOR][COLOR=#000000]([/COLOR]eventObject[COLOR=#000000])[/COLOR][COLOR=#000000]{[/COLOR]
    [COLOR=#f000f0]*// Insert your code here.*[/COLOR]
[COLOR=#000000]}[/COLOR]
myDataGridInstance.[COLOR=#000000]addEventListener[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000ff]"cellPress"[/COLOR], listenerObject[COLOR=#000000])[/COLOR]

```

but if double click on cell an action will be performed.

in macromedia documentation i found script for double click.

```auto

[COLOR=#993300]onClipEvent[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#993300]load[/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
  doubleclickDuration = [COLOR=#000000]300[/COLOR];
  lastClick = [COLOR=#000000]0[/COLOR];
[COLOR=#000000]}[/COLOR]
[COLOR=#993300]onClipEvent[/COLOR] [COLOR=#000000]([/COLOR]mouseUp[COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
  [COLOR=#993300]if[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#993300]this[/COLOR].[COLOR=#993300]hitTest[/COLOR][COLOR=#000000]([/COLOR][COLOR=#993300]_root[/COLOR].[COLOR=#993300]_xmouse[/COLOR], [COLOR=#993300]_root[/COLOR].[COLOR=#993300]_ymouse[/COLOR], [COLOR=#993300]true[/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
    [COLOR=#993300]if[/COLOR] [COLOR=#000000]([/COLOR]lastClick == [COLOR=#000000]0[/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
      lastClick = [COLOR=#993300]getTimer[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
    [COLOR=#000000]}[/COLOR] [COLOR=#993300]else[/COLOR] [COLOR=#000000]{[/COLOR]
      lastClick = [COLOR=#000000]0[/COLOR];
      [COLOR=#993300]trace[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#0000ff]"double click"[/COLOR][COLOR=#000000])[/COLOR];
    [COLOR=#000000]}[/COLOR]
  [COLOR=#000000]}[/COLOR]
[COLOR=#000000]}[/COLOR]
[COLOR=#993300]onClipEvent[/COLOR] [COLOR=#000000]([/COLOR]enterFrame[COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
  [COLOR=#993300]if[/COLOR] [COLOR=#000000]([/COLOR]lastClick>[COLOR=#000000]0[/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
    [COLOR=#993300]if[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#000000]([/COLOR][COLOR=#993300]getTimer[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR]-lastClick[COLOR=#000000])[/COLOR]>doubleclickDuration[COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
      lastClick = [COLOR=#000000]0[/COLOR];
      [COLOR=#993300]trace[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#0000ff]"single click"[/COLOR][COLOR=#000000])[/COLOR];
    [COLOR=#000000]}[/COLOR]
  [COLOR=#000000]}[/COLOR]
[COLOR=#000000]}[/COLOR]

```

Can any one help me how to apply this double click script for cell in dataGrid component.

Thanks in advance

---

<div class="post-metadata">

**Author:** ![tiru](https://avatars.discourse-cdn.com/v4/letter/t/74df32/32.png) [@tiru](https://forum.kirupa.com/u/tiru)\
**Post date:** [April 4, 2006, 8:41am UTC](https://forum.kirupa.com/t/double-click-event-for-datagrid-cell/184205/2 "2006-04-04T08:41:25Z")

</div>

jaust bounce

---

<div class="post-metadata">

**Author:** ![tiru](https://avatars.discourse-cdn.com/v4/letter/t/74df32/32.png) [@tiru](https://forum.kirupa.com/u/tiru)\
**Post date:** [April 5, 2006, 9:31am UTC](https://forum.kirupa.com/t/double-click-event-for-datagrid-cell/184205/3 "2006-04-05T09:31:59Z")

</div>

```auto
doubleclickDuration=300
lastClick=0
var dgListener:Object = new Object();
dgListener.cellPress = function(evt_obj:Object) {
 if (lastClick == 0) {
  lastClick = getTimer();
 } else {
  lastClick = 0;
  trace ("double click");  
 }
};
_root.onEnterFrame = function() {
 if (lastClick>0) {
  if ((getTimer()-lastClick)>doubleclickDuration) {
   lastClick = 0;
   trace("single click");
  }
 }
};

```

---

<div class="post-metadata">

**Author:** ![bootiteq](https://avatars.discourse-cdn.com/v4/letter/b/eb9ed0/32.png) [@bootiteq](https://forum.kirupa.com/u/bootiteq)\
**Post date:** [April 5, 2006, 2:38pm UTC](https://forum.kirupa.com/t/double-click-event-for-datagrid-cell/184205/4 "2006-04-05T14:38:36Z")

</div>

personally i have never tried this but… here is a tute

Flash DataGrid double click  
[http://www.solomon71.com/?p=19](http://www.solomon71.com/?p=19)

i gave this link to someone else and they said it didnt work. Please let me know if it does for you :vamp:
