3 Replies Latest reply on Aug 14, 2008 4:39 PM by Shandy Elliott

    button help

    AFLACROSSE4
      In Scene 1 I have a layer that holds a movie clip called box. inside the movie clip are other movie clips with animation.
      In another layer in Scene 1 i have a MC called "g2" which holds an invisible button and a movie clip called "flame". Inside "g2" on the first frame of the button (not inside the button) i have actionscript that plays the MC flame on rollover:

      stop();

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

      this.onRollOver = function(){
      rewind = false;
      play();
      }

      this.onRollOut = function(){
      rewind = true;
      }

      this.onRelease = function(){
      MAINBOX.gotoAndPlay(5)

      }

      this.onRollOver = function(){
      rewind = false;
      play();
      }


      The on release isn't working. I want it to play the MC box on release. I'm not sure what I'm doing wrong. Please help if you can. Thanks guys.
        • 1. Re: button help
          Shandy Elliott Level 1
          I don't think this can be solved unless I see your flash file. There would be too many questions based solely on this description, so lookinf at the flash file would make it easier for me to solve.
          • 2. Re: button help
            AFLACROSSE4 Level 1
            Ok on restart i lost the file i was working on. So heres the problem again.
            In scene one theres a layer called "g2a" which holds a movie clip called "g2". "G2" holds a mc called "flame" and a button. The animation for "flame is right inside "g2" not flame itself.
            Back at Scene 1, theres a layer called box which holds a MC called box. Inside of box is the animation.

            What i want to happen is on the release of the button in g2a i want it to play the MC box. I don't know how to get the button to play a MC thats not in the same layer. I've attached the file. If anyone could help that would be awesome.

            www.frazierproperties.com/box2c.fla
            • 3. Re: button help
              Shandy Elliott Level 1
              Here is your working example. I think you are going to have problems down the road unless you backtrack a little and understand a little more about proper time line construction. For example, on the layer called Design&Multimedia, you have the movie clip on the first frame, but within the movie clip you have 71 blank frames before you get to your animation. This is the only movie clip I changed for you regarding this. I removed the 71 blank frames in that movie clip and then moved the actual symbol on the main time line from frame 1 to frame 72 (where it originally showed up). This is how it should be done. Also, it's a better idea to place your action scripts on its own layer (either top layer in the time line or bottom) - I use top - instead of on a layer that contains a symbol.

              To fix your other problem, I gave the symbol (g2) an instance name "mcG2" (frame layer g2a at frame number 104). Also, on layer "BOX", I gave it an instance name "mcBox" - you need to give symbols instance names so you can control them with action script - otherwise Flash doesn't know where you are trying to point the script. You will see on the frame labeled "actions" - frame 104, I have code of

              mcG2.onRelease=function(){
              mcBox.gotoAndPlay ("play box")
              }

              If you will open the symbol of "box", you will see how I have reconstructed it. Again, action frame on its own layer. In order to navigate to a particular frame using action script, I used a frame label "play box", then placed a stop(); on the last layer.

              The code you pasted on your first post is incorrect in itself. When you use "this" in your code, you are referring to the time line where that action script lies and nothing else, so that code wouldn't work for anything as it is written.

              The example I changed is here http://www.shan-dysigns.com/flash/box2c.fla