Skip navigation
Currently Being Moderated

How to perform "double click" event in ActionScript 2.0

Nov 25, 2011 5:12 AM

Hi,

i have a movieClip on which i have to perform a "double click" event so is there any Event or procedure to perform this event like we have "MouseEvent.DOUBLE_CLICK" in AS3.

i have used the code

 

dbc.onRelease = dbClick;

function dbClick(){

    if(lastclick - (lastclick=getTimer()) + 500 > 0){

           dbC.text = "double click"

    } else {

                       return;

    }

}

 

its working when i used this code on frame but this code is not working on external AS file. the error related to lastclick.

is there any code like..  "instanceName.addEventListener('DoubleClick', functionName);" in AS2

 

Looking for your help ..

 

Thanks in advance

 
Replies
  • Currently Being Moderated
    Nov 25, 2011 5:28 AM   in reply to iawara

    See if the following is useful for you...

     

    http://greenethumb.com/article/24/double-click-event-in-as2/

     
    |
    Mark as:
  • kglad
    61,990 posts
    Jul 21, 2002
    Currently Being Moderated
    Nov 25, 2011 9:46 AM   in reply to iawara

    there's no as2 double click event like as3.  you have to code it yourself, just like you've done.

     

    if you're code is not working, it's because you have some error that's not apparent from the code you posted.  use the trace() function to debug.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 3, 2011 6:00 PM   in reply to iawara

    is lastclick defined in the external as file? is it being set to the correct value for getTimer()?

     
    |
    Mark as:
  • kglad
    61,990 posts
    Jul 21, 2002
    Currently Being Moderated
    Dec 7, 2011 9:02 PM   in reply to iawara

    use:

     

     

    dbc.onRelease = dbClick;

    var lastclick:Number;

     

    function dbClick(){

        if(lastclick - (lastclick=getTimer()) + 500 > 0){

              trace("doubleclick");

        }

    }

     

    p.s.  please mark helpful/correct responses.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points