A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Double-click in ActionScript 1

  1. #1
    Junior Member
    Join Date
    Jul 2015
    Posts
    2

    Double-click in ActionScript 1

    I must create a mini-app consisting in a visual effect deployed on an image. Events are :
    -- app shows the background image
    -- visual effect starts on double-click (same-background + animation)
    -- visual effect stops on double-click
    -- app shows the background image again (no visual effect).

    The client provided the FLA of the effect. It was done in ActionScript 1. Personally, I’m working with ActionScript 3 (CCS3, 4, 5).
    Adapting the effect was OK, but adding the double-click created a problem : the visual effect simply stopped working.

    I greatly need your help. I don’t know how to introduce the double-click (effect ON/OFF).
    My deadline is almost here and I battle (without success) with this double-click since already four days.

    Please, help a beginner !

  2. #2
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    It's AS2 but it might help you figure it out
    PHP Code:
    var clickSpeed:Number 250;// milliseconds
    var mouseClick:Object = new Object();

    mouseClick.onMouseDown = function(e:Object)
    {
        
    this.lastClicked this.now;
        
    this.now getTimer();

        if (
    this.now this.lastClicked clickSpeed)
        {
            
    button._visible = !button._visible;
            
    trace("Double clicked");
        }
    };

    Mouse.addListener(mouseClick); 

  3. #3
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    Forgot to say, AS3 has its own double click event.
    PHP Code:
    thing.addEventListener(MouseEvent.DOUBLE_CLICKdoubleClickHandler); 

  4. #4
    Junior Member
    Join Date
    Jul 2015
    Posts
    2

    Red face Thank you

    Quote Originally Posted by fruitbeard View Post
    Hi,

    It's AS2 but it might help you figure it out
    PHP Code:
    var clickSpeed:Number 250;// milliseconds
    var mouseClick:Object = new Object();

    mouseClick.onMouseDown = function(e:Object)
    {
        
    this.lastClicked this.now;
        
    this.now getTimer();

        if (
    this.now this.lastClicked clickSpeed)
        {
            
    button._visible = !button._visible;
            
    trace("Double clicked");
        }
    };

    Mouse.addListener(mouseClick); 

    You helped me enormous. Everything is OK now.
    Thank you again (thousand times) !

    Ciberina

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center