A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: ِِِِDisable double click

  1. #1
    Member
    Join Date
    Jan 2009
    Posts
    35

    ِِِِDisable double click

    I wand add some code to a button until avoid double click.
    is there something in as2 like this:
    Actionscript Code:
    on (release) {
         my_button.disabledoubleclick = false;
    }

  2. #2
    Senior Member
    Join Date
    Jun 2007
    Location
    Nottingham, England
    Posts
    203
    Double clicks don't technically exist in flash unless you code them in..

    If you mean to disable a button once it's clicked:

    Actionscript Code:
    on (release) {
    my_button.enabled = false;
    }

  3. #3
    Member
    Join Date
    Jan 2009
    Posts
    35
    thanks
    but I want at least one click and then disable button for next click.
    can u help me

  4. #4
    Senior Member
    Join Date
    Jan 2010
    Location
    England
    Posts
    268
    the code lightspeed gave you would work for one click if you want to be able to click it once for it to do something then click it again to disable it then you could use this:

    Actionscript Code:
    stop();
    timesclicked = 0
    button.useHandCursor = false;
    button.onEnterFrame = function () {
        if (_root.timesclicked ==2) {
            button.enabled = false;
        }
    }
    button.onRelease = function () {
        timesclicked ++
    }
    might be addicted to flash...
    _______________________________________

  5. #5
    Senior Member
    Join Date
    Jun 2007
    Location
    Nottingham, England
    Posts
    203
    Surely if you want to disable double clicking; you only want the button to be clickable once. Then after that one click, it would be disabled. That's what my code will do.

    If you look at the code, it doesn't set the 'enabled' property to false until after the button has been released. Hence 'on (release)'..

  6. #6
    Senior Member
    Join Date
    Jan 2010
    Location
    England
    Posts
    268
    yeah light i thought the same...but meh....whatever the guy wants..one click or two :/
    might be addicted to flash...
    _______________________________________

  7. #7
    Member
    Join Date
    Jan 2009
    Posts
    35
    thanks guys
    I used lightspeed's code. very short and useful. I add below code to my button when I click it run line by line and finally button disable, doesn't find a chance to click again.
    stevehungry your function also seem to work, but I didn't try.
    Wishing you the best!
    Actionscript Code:
    on (release) {
        this._parent.one.gotoAndPlay(21);
        this._parent.two.gotoAndPlay(21);
        this._parent.three.gotoAndPlay(21);
        this._parent.four.gotoAndPlay(21);
        this._parent.five.gotoAndPlay(21);
        this._parent.six.gotoAndPlay(21);
        this.enabled = false;
    }

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