A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Disable button on frame label once I used it? AS3

  1. #1
    Junior Member
    Join Date
    Nov 2017
    Posts
    1

    Unhappy Disable button on frame label once I used it? AS3

    I think I'm doing it right as I have some references from this forum. My question is (not only for me but for some co-colleagues and I also think it can help other users).

    I have this original frame, imagine something as a map, and then I press a button that goes to another frame (a room, for example). When I get back from that room to my map I want that exact button I used to be disabled so I can't play on that room again.

    I've tried some based on this kind of script:

    myBtn.onRelease = function() {
    this.enabled = false;
    }
    and this...

    btn.enabled = false;
    btn.on(MouseEvent.CLICK, hideObject);

    myClip.mouseEnabled = false;
    myClip.mouseChildren = false;
    And some other scripts I've lost track!
    But I think it has something about mouse events, disable or visible?

    I must admit I'm noob now. I've tried a lot of things but I can't find the right answer that works!

    Please tell me if this was answered before because I can't find it anywhere.

    Thank you! I can't thank you enough!

  2. #2
    Senior Member
    Join Date
    Feb 2005
    Posts
    1,834
    I'd suggest doing things a bit differently. In my personal opinion it's a bad idea to use frames in the structure of the game for the most part. It's best to keep all your code in one place. With that said, just add a boolean that you can set to false.
    Code:
    myBtn.onRelease = function() {
    if(btnEnabled){
    //code for button.
    }
    }
    Set it up like this so the boolean determines if it runs.
    .

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