1 Reply Latest reply on May 4, 2006 12:36 PM by Newsgroup_User

    Disabling buttons


      I'm putting together a website which features a basic home swf, that contains an empty movie clip which new pages load into when buttons are pressed on the original home swf file.

      At the moment, although the contents of the new pages cover up the original home swf buttons, they are still clickable.

      I'd like to deactivate them, so that they can not be pressed when they are not visable and a new swf has been loaded, but want them to be activated again, when a "back" button is pressed and the browser is returned to the original home.swf

      Does anyone have any ideas as to how to achieve this?

      I have some actionscript knowledge. but it's very basic.

      Many thanks,

      (using Flash 7 Professional on a mac)
        • 1. Re: Disabling buttons
          Level 7
          This from the Flash helps.

          Flash Player 6.

          Property; a Boolean value that specifies whether a button is enabled. When a
          button is disabled (the enabled property is set to false), the button is
          visible but cannot be clicked. The default value is true. This property is
          useful if you want to disable part of your navigation; for example, you may
          want to disable a button in the currently displayed page so that it can't be
          clicked and the page cannot be reloaded.

          The following example demonstrates how you can disable and enable buttons
          from being clicked. Two buttons, myBtn1_btn and myBtn2_btn, are on the Stage
          and the following ActionScript is added so that the myBtn2_btn button cannot
          be clicked:

          // add two button instances on the Stage
          // give them instance names of myBtn1_btn and myBtn2_btn
          // place the following code on frame 1
          // to enable or disable buttons

          myBtn1_btn.enabled = true;
          myBtn2_btn.enabled = false;

          //button code
          // the following function will not get called
          // because myBtn2_btn.enabled was set to false
          myBtn1_btn.onRelease = function() {
          trace( "you clicked : " + this._name );
          myBtn2_btn.onRelease = function() {
          trace( "you clicked : " + this._name );
          -- Dan Mode *Must Read* http://www.smithmediafusion.com/blog*Flash Helps*