6 Replies Latest reply on May 25, 2006 1:23 AM by Newsgroup_User

    buttons and movieclips

    Level 7
      Hi,

      Can someone please download this .fla file
      http://www.thedesignbank.co.uk/hydro/hydro5.fla

      and preview the movie in flash (not in an internet browser). Once its all
      loaded up click on the big button. It should come up with an error message
      saying "target not found". Now click on the smaller buttons (the ones on
      the left hand side) and they should all work.

      What I want to know is why the smaller ones work and the bigger one doesn't.
      IS there anything wrong with the code?

      Please get back if you know what's wrong or can come up with a solution.

      This is a work in progress, so its quite cluttered, ignore the mess.

      Thanks


        • 1. Re: buttons and movieclips
          Level 7
          Here is the correct code (my way - there is probably many better ways):
          =======
          on (rollOver) {
          gotoAndPlay("rollover");
          }
          on (rollOut) {
          gotoAndPlay("rollout");
          }
          on (release) {
          _root.hometext.gotoAndStop("homeplay");
          _root.concepttext.gotoAndStop("conceptstop");
          _root.advantagetext.gotoAndStop("advantagestop");
          _root.benefittext.gotoAndStop("benefitstop");
          _root.featurestext.gotoAndStop("featuresstop");
          _root.contacttext.gotoAndStop("contactstop");
          }
          =================

          You don't need to use TellTarget anymore, that is old code.
          I added "_root." because the movies you were trying to control are in a
          different "level" then the button that you are pushing.

          Give it a try, it worked for me.

          • 2. Re: buttons and movieclips
            Nickels55 Level 2
            Here is the correct code (my way - there is probably many better ways):
            =======
            on (rollOver) {
            gotoAndPlay("rollover");
            }
            on (rollOut) {
            gotoAndPlay("rollout");
            }
            on (release) {
            _root.hometext.gotoAndStop("homeplay");
            _root.concepttext.gotoAndStop("conceptstop");
            _root.advantagetext.gotoAndStop("advantagestop");
            _root.benefittext.gotoAndStop("benefitstop");
            _root.featurestext.gotoAndStop("featuresstop");
            _root.contacttext.gotoAndStop("contactstop");
            }
            =================

            You don't need to use TellTarget anymore, that is old code.
            I added "_root." because the movies you were trying to control are in a different "level" then the button that you are pushing.

            Give it a try, it worked for me.
            • 3. Re: buttons and movieclips
              jkgiven Level 1
              To: Nickles55
              I would like to ask you a question in regards to your code...
              Lets say that you have one movie clip that plays frames 1 through 12 on the rollOver, and plays frames 12 through 24 on the rollOut.
              Now lets suppose that the mouse rolls out but the movie clip has not reached frame 12 where the stop command is.
              Thus if the MC has only reached frame 1 then it should goto frame 24 on rollout
              same for rollOver 2 to rollOut 23, rollOver 3 to rollOut 22, rollOver 4 to rollOut 21, etc.
              can this be done? how?
              • 4. Re: buttons and movieclips
                Nickels55 Level 2
                jkgiven -
                Ok I think what your saying is that you have a 12 frame animation that then goes in reverse on rollout. So if it only got halfway through it it needs to pick up halfway out of it or it will look goofy... so...
                My solution would be to use variables to find out how far the animation got, then use that info to make it jump to proper rollout frame number. Code with coments //:
                ============
                on(Release){
                var frame = *MovieclipInstanceName*._currentframe;
                // sets frame equal to what ever frame number the movieclip is currently playing

                var jump = 24 - frame
                // if the movie is on frame 2 it will make jump equal to 22)
                *MovieclipInstanceName*.gotoAndPlay(jump);
                ============
                I didn't test this code but I hope you get the concept. That code could be written better because right now that script has to be attached to the button.
                • 5. Re: buttons and movieclips
                  jkgiven Level 1
                  Well I'm just now getting around to trying to learn AS - so this might be a bit much for me, BUT I do completely follow what you are suggesting so now I just have to see if I can figure it out. Thanks for your help.
                  • 6. Re: buttons and movieclips
                    Level 7
                    Thanks you so much mate! My boss has been all over me about this and I had
                    no idea what i was doing.

                    I owe you one!!

                    Cheers
                    "Nickels55" <webforumsuser@macromedia.com> wrote in message
                    news:e52158$4it$1@forums.macromedia.com...
                    > Here is the correct code (my way - there is probably many better ways):
                    > =======
                    > on (rollOver) {
                    > gotoAndPlay("rollover");
                    > }
                    > on (rollOut) {
                    > gotoAndPlay("rollout");
                    > }
                    > on (release) {
                    > _root.hometext.gotoAndStop("homeplay");
                    > _root.concepttext.gotoAndStop("conceptstop");
                    > _root.advantagetext.gotoAndStop("advantagestop");
                    > _root.benefittext.gotoAndStop("benefitstop");
                    > _root.featurestext.gotoAndStop("featuresstop");
                    > _root.contacttext.gotoAndStop("contactstop");
                    > }
                    > =================
                    >
                    > You don't need to use TellTarget anymore, that is old code.
                    > I added "_root." because the movies you were trying to control are in a
                    > different "level" then the button that you are pushing.
                    >
                    > Give it a try, it worked for me.
                    >