6 Replies Latest reply on May 14, 2011 3:56 AM by HDcabeca

    On(press) Beginner help

    HDcabeca

      Hey everyone

      Soo this is a simple problem, i have a 60 frames movie in a Layer, and another layer with 2 buttons.
      I want the movie to play foward while one button keeps PRESSED, and to play backward when we keep pressing the other button.

      i tryed this simple code but it didnt work out...

       

      on (press) {

      nextFrame();

      }

       

      I used this code in the button that plays foward but it only moves 1 frame. I am realy new a this, please some1 help!

        • 1. Re: On(press) Beginner help
          Kajo1313

          this has to be like this:

           

          forward:

          on (press)

          {

               name_of_movie_clip.play();

           

          }

           

           

          back:

          on (press)

          {

               name_of_movie_clip.prevFrame();

          }

          is this it?

          1 person found this helpful
          • 2. Re: On(press) Beginner help
            HDcabeca Level 1

            humm i already tryed that before and it didnt worked, i think i didnt make my self clear on my first post...

            i mean is, when you click the foward button, it would keep playing till you release the foward button! And for the backward button, it would keep doing the same thing, going backwards till you release the button!

            • 3. Re: On(press) Beginner help
              Kajo1313 Level 1

              then you can do it with movie_clip in button or with script like this:

               

               

               

              var int0:Number;

              var time0:Number = 1000/24; //1000 ms(=1s) / 24frames per second (used in swf)

               

              function mc_forward()

              {

                   name_of_movie_clip.nextFrame();

              }

               

               

              function mc_back()

              {

                   name_of_movie_clip.prevFrame();

              }

               

               

               

              forward:

              on (press)

              {

                   int0 = setInterval(mc_forward,time0);

              }

               

              on(release)

              {

                   clearInterval(int0);

              }

               

              on(releaseOutside)

               

              {

                   clearInterval(int0);

              }

               

               

               

              back:

              on (press)

              {

                   int0 = setInterval(mc_back,time0);

              }

              on(release)

              {

                   clearInterval(int0);

              }

              on(releaseOutside)

               

              {

                   clearInterval(int0);

              }

               

               

              Message was edited by: Kajo1313

              1 person found this helpful
              • 4. Re: On(press) Beginner help
                HDcabeca Level 1

                I used the code you gave me yet i can't put it working.. maybe i am doing something wrong?

                 

                this code i putted in the layer of the buttons frame 1 :

                 

                var int0:Number;

                var time0:Number = 1000/24;

                 

                function mc_forward()

                {

                     trike.nextFrame();

                }

                function mc_back()

                {

                     trike.prevFrame();

                }

                 

                 

                i puted this on the button to play the movie :

                 

                on (press) {

                     int0 = setInterval(mc_forward,time0);

                }

                 

                on(release) {

                     clearInterval(int0);

                }

                 

                on(releaseOutside) {

                     clearInterval(int0);

                }

                 

                i puted this on the button to play the movie backwards :

                 

                on (press) {

                     int0 = setInterval(mc_back,time0);

                }

                on(release) {

                     clearInterval(int0);

                }

                on(releaseOutside) {

                     clearInterval(int0);

                }

                 

                i test the flash and when i click in the buttons nothing happens the movie simple does not move!

                 

                • 5. Re: On(press) Beginner help
                  Kajo1313 Level 1

                  give me your e-mail, i will send it

                  • 6. Re: On(press) Beginner help
                    HDcabeca Level 1

                    problem solved, thanks!