3 Replies Latest reply: Jun 29, 2012 1:43 PM by dcrouse10 RSS

    gotoAndStop is Erratic

    dcrouse10 Community Member

      I am building a Flash (Pro CS6) interface for use in Captivate 5.5.  It has a pause button which, when clicked, should stop playback, then jump to frame 10 where the play button appears.  The play button, when clicked, should resume playback then jump to frame 1 where the pause button appears again.


      Previewing in Flash (using F12), clicking on Pause does nothing; no jumping, and Play never appears.


      If I change the MovieClip declaration to (root), the Pause/Play buttons cycle properly (but without issuing any commands to Captivate).


      There are Replay and Restart buttons on the UI as well, which always seem to work.


      Help!  Thanks.


      This is the code for Frame 1, with the Pause button (PausePlay).


      // Stop Playback at this frame and wait



      // Importation and Decalration

      import flash.events.MouseEvent;
      import flash.display.MovieClip;


      var captivate:MovieClip = MovieClip (root.parent.root); // The problem may live here.

      var now:Number = captivate.cpInfoCurrentSlide;


      // Pause button, on click, jump to frame 10 and pause Cap playback

      PausePlay.addEventListener (MouseEvent.CLICK,away);


      function away (event:MouseEvent):void {
          captivate.rdcmndPause = 1;
          gotoAndStop (10);


      // Replay button, on click, have Cap start the current slide again

      Replay.addEventListener (MouseEvent.CLICK, noJump);


      function noJump (event:MouseEvent):void {
          captivate.cpCmndGotoSlideAndResume = now - 1;


      // Restart button, on click, Cap will jump to slide 2 to restart session from the beginning

      Restart.addEventListener (MouseEvent.CLICK, reStart);


      function reStart (event:MouseEvent):void {
          captivate.cpCmndGotoSlideAndResume = 1;


        • 1. Re: gotoAndStop is Erratic
          kglad MVP

          var captivate:MovieClip = MovieClip (root.parent.root); // is incorrect.


          what that should be i'm unable to say without knowing the relationship between the fla that contains your code and your captivate swf.

          • 2. Re: gotoAndStop is Erratic
            dcrouse10 Community Member

            I suspected that was the line, but I haven't found a combination that works.


            Flash is used to create the UI.  I publish and then, in Captivate, import the SWF animation file to a Master Slide.  The end product will be a single file published through Captivate.


            The other buttons (Replay and Restart) both work fine, which makes it even more confusing.


            Does that help?

            • 3. Re: gotoAndStop is Erratic
              dcrouse10 Community Member

              Here is how I got it to work.


              From frame 10, I jumped to a new keyframe 20 which with the gotoAndStop command and all of the resources. That didn't work.


              However, when I removed the code from frame 20 and added a second keyframe at 21 with the gotoAndStop command in that frame, everything worked.


              Keep adding keyframes 'til it works?


              I think I am confused. But at least it's working. Huzzah.