6 Replies Latest reply on Oct 19, 2006 6:31 PM by Mikeb88_69

    Button problem

    Mikeb88_69
      I have 2 movie clips (photo1_m, and photo2_m).

      Inside of these movie clips are 1 button (photo1_b, photo2_b)

      What I want is, when you roll over the button, the entire screen fades to back as a picture fades in. When you roll out, they both fade out (using a rewind function).

      The code I have for BOTH movie clips are:

      (in first frame)

      stop();
      Mouse.show();

      this.onEnterFrame=function();{
      if (rewind==true){
      prevframe();
      }
      }

      EXPLANATION: I have a function, if rewind is true, go to the previous frame until rewind equals false

      (applied to buttons)

      on (rollOver){
      rewind=false;
      play();
      }

      on (rollOut){
      rewind=true;
      }

      EXPLANATION: When they roll over the button, play the movie clip (which contains fade in animation), when they roll out, execute the rewind function

      (in last frame)

      stop();
      Mouse.hide();

      EXPLANATION: Once the fade in is complete, stop on the last frame, hide the mouse, and wait for roll over to rewind

      PROBLEM
      The first movie clip (photo1_m) works absolutely perfect and does exactly what I want it to do. The second movie clip doesnt work at all. It has the exact layout and the exact code?

      THANKS :D
        • 1. Re: Button problem
          Mikeb88_69 Level 1
          Bumpity bump bump!
          • 2. Re: Button problem
            Mikeb88_69 Level 1
            anyone know the answer?
            • 3. Re: Button problem
              TimSymons Level 1
              What version of Flash do you have?

              I put your code into a movie and it worked. I copied it directly from the code above. The only thing that came back was during compiling (in Flash 8) was that the onEnterFrame defintion was missing a "}" and had an extra ";". It should be:

              this.onEnterFrame=function() {
              if (rewind==true){
              prevframe();
              }
              };

              Tim

              • 4. Re: Button problem
                Mikeb88_69 Level 1
                I am using Flash 8. That was a typo in the forums, my actual code has that. Is there a problem when you have two functions in different movie clips trying to work at the same time or something? Because the very first movieclip/button work perfectly....the second one doesnt work at all.
                • 5. Re: Button problem
                  TimSymons Level 1
                  Mike,

                  It worked as I expected and each movieclip was functioning separately from the other. The only thing that I had a little trouble with was that when the mouse was hidden, it was difficult to tell when it was over the other button until it just suddenly appeared.

                  Tim
                  • 6. Button problem
                    Mikeb88_69 Level 1
                    I just started from scratch and really payed attention to the code and everything worked perfectly. Thanks :D

                    Now I have a new problem though. Since these buttons are on the same layer, when one button is rolled over, it needs to move in from of the other two. I have used a normal swapdepths(1000); in each movie clip, but that doesnt work. How do I make the movie clip come to the front of the other two at all times?

                    UPDATE:

                    Nevermind, used this code for swapping depths:

                    _root.x+=2;
                    this.swapDepths(_root.x);