A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: How to disable a button/action after a single click?

Hybrid View

  1. #1
    Junior Member
    Join Date
    May 2008
    Posts
    4
    wow thanks works perfect. Thanks!!

    Only problem is (and im not sure if there will be a work around)
    Is on the first keyframe, there is 3 buttons, so basically pasted 3 times, and the button names changed accordingly.
    I notice i also need to increment "mouseuphandler" as well to mouseuphanlder1..2..3 ..etc so given there will be about 20-30 entries i just increment as necessary.. or is there a way around this?
    As when you click a button it plays 15frames or so and stops, then those buttons need to be clickable, so the same script is used except now i need mouseuphandler 4,5,6
    Is that just the way it needs to be?

    Cheers

    excuse any stupid questions, pretty much a newb at AS3.. and most sorts of script/code TBH

  2. #2
    you can reuse the same function.

    Code:
    function mouseUpHandler(evt:MouseEvent):void {
       gotoAndPlay(2);
       evt.currentTarget.removeEventListener(MouseEvent.MOUSE_UP,mouseUpHandler);
    }
    the currentTarget is what is calling the event, and that is the movieclip you called the addEventListener for.

  3. #3
    Senior Member
    Join Date
    Jun 2007
    Posts
    204
    target_button.mouseEnabled = false;

    Removes the listener and the hand cursor doesn't appear when rolled over.

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