2 Replies Latest reply on Jul 7, 2009 11:27 AM by eapre

    Still need help with play and pause

    eapre

      Ok, I thought I had my problem figured out but as I looked more closely I found I didn't, so I guess I'll repost it.  My movieclip animation is replaying when the playpause_btn is pressed, but I don't want it to replay if the movieclip has already played.

       

      I don't know where to put the code that checks to see if content2anim_mc has played through its _totalframes, and if it has, to make sure not to play it again.

       

       

       

      playpause_btn.onRelease = function() {
          if (audioplay == true) {
              p = Math.round(_root.Sound2.position/1000);
              _root.Sound2.stop();
              audioplay = false;
              play_mc._visible = true;
              pause_mc._visible = false;
              content2anim_mc.stop();

       

          } else {
              _root.Sound2.start(p,0);
              audioplay = true;
              pause_mc._visible = true;
              play_mc._visible = false;
              content2anim_mc.play();
          }
      };

       

       

      I was thinking something like this code below???

       

      var mcDone:MovieClip = content2.content2panel.content2anim_mc;
          if (content2anim_mc._currentframe = _totalframes) {
              content2anim_mc.stop();
          };

       

      Thanks again!

        • 1. Re: Still need help with play and pause
          Ned Murphy Adobe Community Professional & MVP

          Try:

           

           

           

          playpause_btn.onRelease = function() {
              if (audioplay == true) {
                  p = Math.round(_root.Sound2.position/1000);
                  _root.Sound2.stop();
                  audioplay = false;
                  play_mc._visible = true;
                  pause_mc._visible = false;
                  content2anim_mc.stop();

           

              } else {
                  _root.Sound2.start(p,0);
                  audioplay = true;
                  pause_mc._visible = true;
                  play_mc._visible = false;

                 if(content2anim_mc._currentframe < content2anim_mc._totalframes ){
                       content2anim_mc.play();

                 }
              }
          };

          1 person found this helpful
          • 2. Re: Still need help with play and pause
            eapre Level 1

            Thanks, that worked and now my movieclip does not replay.  I discovered something else wrong though!  I've discovered that there's a problem with toggling between pressing the replay button and the play/pause button.  I press replay, then play/pause, then replay, then play/pause again and the audio starts playing twice.  Maybe it's because I'm using both audioplay = true; AND _root.Sound2.start

             

            Also, I've got the play icon and the pause icon as two different movieclips (they don't do anything) on top of the main playpause_btn that are made visible and invisible depending on when playpause_btn is clicked.  It's kind of a complicated sloppy-looking way to do it...

             

            Maybe there's a totally different and better/easier way I can go about this?

             

            //audio
            audioplay = true;
            _root.Sound2.start(0, 0);

            play_mc._visible = false;
            //replay button
            replay.onRelease = function() {
                stopAllSounds();
                _root.Sound2.start(0, 0);
                content2anim_mc.gotoAndPlay(1);
            };

            //playpause button
            playpause_btn.onRelease = function() {
                if (audioplay == true) {
                   p = Math.round(_root.Sound2.position/1000);
                    _root.Sound2.stop();
                    audioplay = false;
                    play_mc._visible = true;
                    pause_mc._visible = false;
                    content2anim_mc.stop();
                } else {
                    _root.Sound2.start(
            p,0);
                    audioplay = true;

                    pause_mc._visible = true;
                    play_mc._visible = false;
                       if(content2anim_mc._currentframe < content2anim_mc._totalframes ){
                    content2anim_mc.play();
                       }
                }

             

            Thanks for being patient here, it's a learning experience