PDA

View Full Version : How to implement double-click in ListBox?


ennpoiss
01-14-2003, 06:32 AM
hola everyone!

How to implement mouse double-click event in
ListBox? I need exactly the same functionality of
ListBox plus double-click event to trigger additional
actions. Is it possible? I'm pretty desperate already :(

thanks in advance,
ennpoiss

jimburton
01-14-2003, 08:48 AM
there isn't a double click event in flash so you have to make your single click event look for it...something like:

counting = false;
function clickHandler() {
if (!counting) {
counting = true;
t = getTimer();
trace("startCounting!");
} else {
var now = getTimer();
var elapsed = now-t;
if (elapsed>1000) {
t = now;
trace("startCounting from scratch again!");
} else {
trace("double click!");
counting = false;
}
}
}

and where the trace ("double click!") is, put your double click code

ennpoiss
01-14-2003, 12:16 PM
ClickHandler function works well :)

but.. ListBox selection bar does'nt show up anymore?!?
I need that thing too.

Where is the right place to put this pice of code in my fla
file?

onClipEvent (load) seems to be wrong place..

ennpoiss

jimburton
01-14-2003, 12:42 PM
put it in the main timleine and type 'clickHandler' in the changehandler part of the listbox component parameters inspector....

I don't know what you mean re the selection bar - can you explain? thx,

ennpoiss
01-14-2003, 01:25 PM
thanx man. It works now as needed :) :)
Much easyer than I expected :)

muchos gracias ;)
ennpoiss

jimburton
01-14-2003, 01:42 PM
everythings easy when you know how ;)

farafiro
01-14-2003, 01:47 PM
here is a cool one also
http://www.layer51.com/proto/d.aspx?f=385