Skip to main content
Inspiring
September 20, 2009
Answered

Problems detetecting Double Click

  • September 20, 2009
  • 2 replies
  • 1560 views

I am writing a solitaire game.  The cards are clips, buttonMode=true, mouseEnabled = true, doubleClick= true.

I have added event listeners for DOWN, UP, DOUBLE_CLICK, CLICK.

I cannot get the double click to work.  when i double click it is treated as a Down,UP,Down.

I am having problems because I need the down state if i just want to move the card I need the down event.

The UP I am using to release the drag.  But I cannot get the double click event to ever be recognized.

I am using action script 3.

Thanks for any help.

This topic has been closed for replies.
Correct answer kglad

I believe I see the problem now.  The problem is that when the down state is hit I am assuming the request is to

move the card (drag).  If i comment out the move (drag) routine where I am creating a container to drag the card

or cards, then the double click is detected.  Now I guess I need to figure away to differentiate between a request to

drag or a double click.

So, you did answer my question that i have been trying to resolve for months.  It is my logic but I would never have

come to this conclusion without your help.

I thank you very much...still got a problem but it is not with the double click not being detected.

I really do appreciate your time and help.

thanks.


you're welcome.

2 replies

teremotoAuthor
Inspiring
September 21, 2009

Well, when i double click on the card, the function for double click is not called.  I put a trace in the function and it is never hit.

But i will receive a message in the Click, Down and Up functions.

I must be doing something wrong but i honestly cant see it.  i have tried using timers but this just seems like i am trying to

bandade my logic.

any suggestions?

thanks i do appreciate your help

teremotoAuthor
Inspiring
September 21, 2009

i am not sure what other code i can show you and i do realize it makes it easier.  but is there some porperty that needs to

be disabled?  Would this behave differently if i used a button instead of a movie clip?

My other code basically handles the request so I dont think it would be useful.  If i cant detect the event, i must be doing

something else wrong.

thanks again for your help.

kglad
Community Expert
Community Expert
September 21, 2009

attached is a sample file with your code that works.

kglad
Community Expert
Community Expert
September 20, 2009

copy and paste (only) the relevant code.

teremotoAuthor
Inspiring
September 20, 2009

I have a lot of code and I am not sure what to paste for u to look at.

I hope this description helps.

Standard Solitaire.

All the cards are layed out and only the cards that are face up have event listeners.

TheCard:MovieClip = new CardClip();          //CardClip is a clip of all 52 cards

now say the card is a 10 of hearts, then

TheCard.gotoAndStop(10H);       //10H is a frame label in the clip

TheCard.buttonMode = true;

TheCard.mouseEnabled = true;

TheCard.doubleClickEnabled = true;

TheCard.addEventListener(MouseEvent.DOUBLE_CLICK, mouseDB);
TheCard.addEventListener(MouseEvent.CLICK, mouseCK);
TheCard.addEventListener(MouseEvent.MOUSE_UP, mouseUP);
TheCard.addEventListener(MouseEvent.MOUSE_DOWN, mouseHandlerDown);

addChild(TheCard);

When I double click on that card, then double click is never recognized.  The events recognized

are DOWN, UP and CLICK.

Thanks for your help and I hope  I have given you enough info.  This is frustrating.

kglad
Community Expert
Community Expert
September 20, 2009

there's no coding problem there.  what makes you think your double click isn't working?