A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: as2 problemo... pls help... how to limit users clicks

  1. #1
    Senior Member
    Join Date
    Sep 2006
    Posts
    248

    as2 problemo... pls help... how to limit users clicks

    Hi there...
    I am trying to limit the amount of clicks that i will receive by, maximum, one click per second.
    How could I limit the interaction of the user to just one click per second?

    Lets say, just ONE move to the left per second and NO more than that.

    Thanks,
    Cheers.
    Leo.

  2. #2
    Senior Member dudeqwerty's Avatar
    Join Date
    Mar 2005
    Location
    Bosnia
    Posts
    1,626
    make a setTimeout on every mouse click to switch a boolean:
    Code:
    var canClick:Boolean = true;
    function mouseClicked() {
        // PUT YOUR CODE HERE
    }
    function switchCanClick() {
        canClick = true;
    }
    onMouseDown = function() {
        if(canClick) {
            mouseClicked();
            canClick = false;
            setTimeout(switchCanClick, 1000);
        }
    };
    New sig soon

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