2 Replies Latest reply on Oct 22, 2006 7:06 AM by aniebel

    Flash Buttons with Actionscript

    ty_tinman
      http://img.photobucket.com/albums/v516/ty_tinman/buttonproblem.jpg

      I am having an issue with the above setup, I would appreciate any help I could get with this please.

      Basicly what I need is:

      When you rollover the button, I want it to go to the "over" keyframe, and when you rollout of the button I want it to go to the "back"key frame. I had these in and took them out as they were conflicting with the next problem:

      When you click on one of the buttons for example the "quilt" one, I need it to stay in the state after the the over animation is done so basicly I need it to stop at frame 9. Now if you click on one of the other buttons I need the "quilt" button to go and play the "back" keyframe, which makes it slide back to the default position.

      So if one button is currently active (meaning that section is what you are viewing, it needs to stay at keyframe 9 (which has a stop on it), and as soon as any of the other buttons are clicked, the button that was previously active (section that was being viewed) should go and play the "back" keyframe so it slides back to default. However, As I have it now I don't have the rollover and rollout functions in because they were causing issues, also every single button even if it wasn't active goes and plays the "back" frame when another button is clicked. So there must be some sort of "if" condition that I can use but I am really not certain how I can do this, your help is appreciated.

      Also not forgetting that I need it to also have rollover and rollout effects, so on over play "over", and on rollout play "back"

      I can be emailed at tyler_tinney@hotmail.com, I would greately appreciate your help with this matter, I've been stuck on it for days now.
        • 1. Flash Buttons with Actionscript
          ty_tinman Level 1
          I now have it working except for it still acts weird:

          When you click on a button, all buttons still go and play the "back" keyframe. I need there to be some sort of condition in there that if the frame /=9 then do nothing, if frame = 9 then play the "back" keyframe ...

          The code now looks like:

          on (rollOver) {
          gotoAndPlay("over");
          }
          on (rollOut, release) {
          gotoAndStop(9);
          gotoAndPlay("back");
          }
          on (release) {
          _parent["art"].gotoAndPlay("back");
          _parent["quest"].gotoAndPlay("back");
          _parent["rules"].gotoAndPlay("back");
          _parent["eyria"].gotoAndPlay("back");
          _parent["about"].gotoAndPlay("back");
          _parent["home"].gotoAndPlay("back");
          }
          • 2. Re: Flash Buttons with Actionscript
            aniebel Level 2
            Hi there. I tried to guess at what you're trying to do so forgive me if I got it wrong.

            First off, try to avoid putting code on your buttons. You'll find in the long run it's better to place as much code as possible on your main timeline in it's on layer which is locked to avoid placing symbols on it. For me, it's easier to control everything from one common place (target issues) and when you come back to a project months later, it's easier to find everything if it's all in one place. That in mind...

            Try putting this code on your main timeline, as I mentioned (in it's own, locked layer):