• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

gotoAndStop is Erratic

Explorer ,
Jun 28, 2012 Jun 28, 2012

Copy link to clipboard

Copied

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

stop();

// 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;
}

----------

TOPICS
ActionScript

Views

1.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 28, 2012 Jun 28, 2012

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 28, 2012 Jun 28, 2012

Copy link to clipboard

Copied

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 29, 2012 Jun 29, 2012

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines