7 Replies Latest reply on Sep 21, 2011 4:38 PM by kglad

    How to Make Movie Clips Play Individually?

    louise415 Level 1

      I have set up a single, one-page resume/portfolio website, but I'm having difficulty finding a way to get the 2 individual movie clips to play individually - not at the same time.

       

      Example: www.louise-gd.com (intro page only)

       

      Everything is set up on a time line. Each movie clip has it's own layer with it's own button via Code Snippets as follows:

       

       

       

      CArrow1.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_15);

       

      function fl_ClickToGoToAndStopAtFrame_15(event:MouseEvent):void

      {

      gotoAndStop(11);

      }

       

       

      If I set both clips up on, say, line 15, both movie clips play at the same time regardless of which arrow button is clicked. If I move one of the clips, to say, line 17, then the other movie disappears. Argh.

       

       

      OH AND! I don't know how to set this up so the viewer can click the button again and again to play the movie again and again, once it's played through the first time.

       

      How can I fix these?

        • 1. Re: How to Make Movie Clips Play Individually?
          kglad Adobe Community Professional & MVP

          use:

           

           

          CArrow1.addEventListener(MouseEvent.CLICK,f);

          yourothermovieclip.addEventListener(MouseEvent.CLICK,f);

           

          function f(event:MouseEvent):void

          {

          MovieClip(e.currentTarget).play()

          }

           

           

          • 2. Re: How to Make Movie Clips Play Individually?
            louise415 Level 1

            I keep getting this error message:

             

            Scene 1, Layer 'Actions', Frame 10, Line 26 1086: Syntax error: expecting semicolon before addEventListener.

             

            when I replaced my copy with yours as follows:

             

            CArrow1.addEventListener(MouseEvent.CLICK,f);

            11.addEventListener(MouseEvent.CLICK,f);

             

            function f(event:MouseEvent):void

            {

            MovieClip(e.currentTarget).play()

            }

             

            and

             

            CArrow1.addEventListener(MouseEvent.CLICK,f);

            27.addEventListener(MouseEvent.CLICK,f);

             

            function f(event:MouseEvent):void

            {

            MovieClip(e.currentTarget).play()

            }

             

             

            Please advise,

            Louise Audell

            • 3. Re: How to Make Movie Clips Play Individually?
              kglad Adobe Community Professional & MVP

              CArrow1.addEventListener(MouseEvent.CLICK,f);

              11.addEventListener(MouseEvent.CLICK,f);  // <- this is wrong.  you can't use a number in the left-most position

               

              function f(event:MouseEvent):void

              {

              MovieClip(e.currentTarget).play()

              }

               

              and

               

              CArrow1.addEventListener(MouseEvent.CLICK,f);  // this shouldn't be used twice

              27.addEventListener(MouseEvent.CLICK,f);  // incorrect.

               

              function f(event:MouseEvent):void  // this function shouldn't be defined twice

              {

              MovieClip(e.currentTarget).play()

              }

               

               

              • 4. Re: How to Make Movie Clips Play Individually?
                louise415 Level 1

                Kglad:

                 

                Now I get these two (2) error messages:

                 

                Scene 1, Layer 'Actions', Frame 10, Line 30 1120: Access of undefined property e.

                Scene 1, Layer 'Actions', Frame 10, Line 26 1120: Access of undefined property PreviousWork_MC.

                 

                I don't understand.

                 

                Please advise,

                Louise Audell

                • 5. Re: How to Make Movie Clips Play Individually?
                  kglad Adobe Community Professional & MVP

                  event should be e:

                   

                  CArrow1.addEventListener(MouseEvent.CLICK,f);

                  yourothermovieclip.addEventListener(MouseEvent.CLICK,f);

                   

                  function f(e:MouseEvent):void

                  {

                  MovieClip(e.currentTarget).play()

                  }

                  • 6. Re: How to Make Movie Clips Play Individually?
                    louise415 Level 1

                    When using this:

                     

                    CArrow1.addEventListener(MouseEvent.CLICK,f);

                    PreviousWork_MC.addEventListener(MouseEvent.CLICK,f);

                     

                    function f(e:MouseEvent):void

                    {

                    MovieClip(e.currentTarget).play()

                    }

                     

                    I still get this error message:

                     

                    Scene 1, Layer 'Actions', Frame 10, Line 26 1120: Access of undefined property PreviousWork_MC (the other movie clip).

                     

                    There are two separate movie clips on two separate lines on the same page. Both are set up with a button function to play each movie. Wouldn't both buttons need some type of code to tell the other movie to not play with this movie clip is playing? If I use this code to set up both buttons, I get an error message saying I've got duplicate of the same code.

                     

                    Argh. 

                    Louise Audell

                    • 7. Re: How to Make Movie Clips Play Individually?
                      kglad Adobe Community Professional & MVP

                      your other movieclip is not PreviousWork_MC, at least, not to flash when that (or some other) code executes.  click, what you think is, PreviousWork_MC (to select it) and in the properties panel assign its instance name, PreviousWork_MC

                       

                      retest.