Skip to main content
ajustltd
Participant
May 16, 2023
Question

Disable buttons on Adobe animate canvas

  • May 16, 2023
  • 1 reply
  • 503 views

Hi All,

I am trying to disable 5 buttons from a movieclip timeline so they're out of use though still visable.

 

Currently I have 1 button controling 1 movieclip, the button tells the movieclip move forward one frame and play, this plays till frame 5 and stops _this.stop(); and at this point I need to tell the _root timeline to disable 5 buttons.

 

By clicking a close button _this.play(); the frame plays out frame 6 to 10 and I will need to enable the 5 buttons again before frame 10.

 

Whats the best way to disable and enable a button, is it from an action or on enter frame. Could someone plaese help me with this Adobe Animate Canvas code please?

 

Button controlling movieclip

var _this = this;
_this.secure_btn.on('click', function(){
_this.Secure_Overlay.gotoAndPlay(2);

});

 

Thanks

 

    This topic has been closed for replies.

    1 reply

    JoãoCésar17023019
    Community Expert
    Community Expert
    May 16, 2023

    Hi.

     

    You can either set the property mouseEnabled to false on the buttons to disable mouse interaction on them or set the property mouseChildren to false on the Movie Clip that contains them so that all children in it won't react to the mouse. Then you can just set these properties back to true to enable the buttons again.

     

    I hope it helps.

     

    Regards,

    JC

    ajustltd
    ajustltdAuthor
    Participant
    May 16, 2023

    Hi JC,

     

    Thanks for the reply, could I ask how you would write this in a frame?

     

    Currently my end frame talks to the current MovieClip, but how do i talk to the root?

     

    'Secure_Overlay' is my current MovieClip endFrame

    var _this = this;
    _this.gotoAndStop(1);

     

    How would I add to disable secure_btn from being active?

     

    Is it _root.secure_btn.mouseDown(false);

     

    Thanks

    Justin

    kglad
    Community Expert
    Community Expert
    May 16, 2023

    you can use exportRoot.