A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Disable button click event in AS3

  1. #1
    Junior Member
    Join Date
    Mar 2012
    Posts
    2

    Disable button click event in AS3

    Hi, I'm trying to disable the button click event on a button with no luck. I did some searching but it would always display an error.


    button_1.addEventListener(MouseEvent.CLICK,mouseUp Handler);

    function mouseUpHandler(evt:MouseEvent):void {
    gotoAndPlay(2);
    button_1.removeEventListener(MouseEvent.CLICK,mous eUpHandler);
    }


    But when I set that, I'm still able to click on that button (the actual Over button state animation still occurs).
    Any thoughts would be great?

    Thanks,
    Josh
    Last edited by izzysanime; 03-06-2012 at 12:52 PM.

  2. #2
    Member
    Join Date
    Apr 2010
    Posts
    87
    Actionscript Code:
    button_1.mouseEnabled = false;

  3. #3
    Junior Member
    Join Date
    Mar 2012
    Posts
    2
    Thanks for the suggestion, i did try that, but it disables all mouse events. I still would like to have the hover/over state work, just not the click/down state.

    Thanks,
    Josh

  4. #4
    Member
    Join Date
    Apr 2010
    Posts
    87
    in this case you need to create custom button yourself.
    use movie clip, draw the states in frames and then manage add event listeners for the states you'd like.

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