Double Click event in AS2

Some of us are still use AS2 here and there, and some of us want to be able to capture something like the AS3 MouseEvent.DOUBLE_CLICK. I wrote a simple decorator class called DoubleClickable to give a MovieClip the ability to broadcast doubleClick events.

The example below is hopefully pretty self explanatory :)

Just import the class and wrap your [email protected] with the the @DoubleClickable class.

import com.visicswire.wrappers.DoubleClickable;

var dbc:DoubleClickable = new DoubleClickable(star);
dbc.addEventListener('doubleClick', Delegate.create(this, _handleDbleClick));

Grab the source files for a hands on example.

10 Responses to 'Double Click event in AS2'

  1. Clint says:

    Thanks, this is just what I needed, is there a way to remove the double click functionality once its been applied to a movieclip?

  2. jonathan says:

    you could always use <code>removeEventListener<code>, but this is AS2 so it would have to be something like:

    var dblDelegate:Function = Delegate.create(this, _handleDoubleClick);

    var dbc:DoubleClickable = new DoubleClickable(star);
    dbc.addEventListener(‘doubleClick’, dblDelegate);

    dbc.removeEventListener(‘doubleClick’, dblDelegate);

  3. jonathan says:

    grrrr…. have to fix my <code> tags in the comments…. :)

  4. Tomer says:


  5. Nagarajan says:

    it’s really superb. Great thanks to You.

  6. dhiraj says:


  7. Matthias says:

    Godlike! Thank you very much, sir!

  8. Dav says:

    Hey, very nice snippet, but we can not separate simple click from double click. When I double click, that gives this behavior : “click – doubleclick – click”.
    So even with a function, define with a Boolean for example, it’s difficult to disable click action at double click.

  9. Razvan says:

    Hi Jonathan, thank you for this :) Much appreciated, works perfect !

  10. zermok says:

    the source link has redirected loop.
    I hope it’s still available since it’s a very good class

Leave a Reply

Your email address will not be published. Required fields are marked *