Double click event for dataGrid cell?

hi

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


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.


[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

jaust bounce

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");
  }
 }
};

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

Flash DataGrid double click
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: