5 Replies Latest reply on Nov 1, 2006 2:47 PM by spectre_fish

    need help with script

    spectre_fish

      I'm very new to flash and I'm slowly building a website. I have some buttons created and want a certain function to stop when another one is initiated. Here is the actionscript:

      btnHome_mc.onRollOver = function () {
      btnHome_mc.gotoAndPlay("_rollover");
      }
      btnHome_mc.onRollOut = function () {
      btnHome_mc.gotoAndPlay("_rollout");
      }
      btnHome_mc.onRelease = function () {
      btnHome_mc.gotoAndPlay("_click"); gotoAndStop("home");
      }

      I want the onRollOut function to stop once the onRelease function is initiated. Can anyone help?
        • 1. Re: need help with script
          Level 7
          You could always disable the button:

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

          --

          Dan Mode
          --> Adobe Community Expert
          *Flash Helps* http://www.smithmediafusion.com/blog/?cat=11
          *THE online Radio* http://www.tornadostream.com
          *Must Read* http://www.smithmediafusion.com/blog



          "spectre_fish" <webforumsuser@macromedia.com> wrote in message
          news:ei5tku$7qe$1@forums.macromedia.com...
          >
          > I'm very new to flash and I'm slowly building a website. I have some
          > buttons
          > created and want a certain function to stop when another one is initiated.
          > Here
          > is the actionscript:
          >
          > btnHome_mc.onRollOver = function () {
          > btnHome_mc.gotoAndPlay("_rollover");
          > }
          > btnHome_mc.onRollOut = function () {
          > btnHome_mc.gotoAndPlay("_rollout");
          > }
          > btnHome_mc.onRelease = function () {
          > btnHome_mc.gotoAndPlay("_click"); gotoAndStop("home");
          > }
          >
          > I want the onRollOut function to stop once the onRelease function is
          > initiated. Can anyone help?
          >


          • 2. need help with script
            spectre_fish Level 1
            That works perfectly THANKS!

            However it does present me with another issue, I have 4 buttons that take me to a different page of my site. If I use the "this.enabled=false" script for each button, I get the effect I'm looking for with the press of the button, but I want that effect to switch back to the original onRollOut event when any of the other 3 buttons are pressed. Can you help out once again?

            I sincerely appreciate it!!!

            P.S. Happy Halloween.
            • 3. Re: need help with script
              Level 7
              So, basically...clicking on a button would disable itself but enable the
              others?

              btnHome_mc.onRelease = function () {
              this.enabled=false;
              btnOther.enabled=true;
              btnOther2.enabled=true;
              }

              btnOther.onRelease = function () {
              this.enabled=false;
              btnHome_mc.enabled=true;
              btnOther2.enabled=true;
              }

              btnOther2.onRelease = function () {
              this.enabled=false;
              btnHome_mc.enabled=true;
              btnOther.enabled=true;
              }


              --

              Dan Mode
              --> Adobe Community Expert
              *Flash Helps* http://www.smithmediafusion.com/blog/?cat=11
              *THE online Radio* http://www.tornadostream.com
              *Must Read* http://www.smithmediafusion.com/blog


              "spectre_fish" <webforumsuser@macromedia.com> wrote in message
              news:ei7vnn$n6l$1@forums.macromedia.com...
              > That works perfectly THANKS!
              >
              > However it does present me with another issue, I have 4 buttons that take
              > me
              > to a different page of my site. If I use the "this.enabled=false" script
              > for
              > each button, I get the effect I'm looking for with the press of the
              > button, but
              > I want that effect to switch back to the original onRollOut event when
              > any of
              > the other 3 buttons are pressed. Can you help out once again?
              >
              > I sincerely appreciate it!!!
              >


              • 4. Re: need help with script
                spectre_fish Level 1
                That is very, very close to what I want. The only difference is I want the onRollOut event for just the button that is disabled to automatically play when the button is enabled again.

                example: I press the "home" button and it gets disabled and enables the rest of the buttons.
                Then I press the "contact" button and it gets disabled and enables the rest of the buttons AND plays the onRollOut function for the "home" button that was disabled.

                In other words, whichever button that is disabled has it's onRollOut event play once it's re-enabled.

                Hope that is clear enough.

                Thank you very much!
                • 5. Re: need help with script
                  spectre_fish Level 1
                  is this possible?