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

Automatic toggle custom play/pause at end of slide?

Participant ,
Mar 07, 2019 Mar 07, 2019

Copy link to clipboard

Copied

I´ve created a custom play/pause button as Lilybiri describes in her blog. The problem now is: I have several stops in my project, giving the learner time and opportunity to read and/or click. These stops are always at the end of a slide. At these moments the toggle buttom should change from its pause state to a play state. But the variable cpCmdPause in my script doesn`t notice that the projects pauses (because its an action depending on a click on the toggle button).

How can I get the toggle button and/or the action script to notice that the project stops at a specific time?

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 ,
Mar 07, 2019 Mar 07, 2019

Copy link to clipboard

Copied

I am on the road, no screenshots possible

You will have to check the status of cpCmndPause within any extra advanced

action and show the appropriate state.

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
Participant ,
Mar 07, 2019 Mar 07, 2019

Copy link to clipboard

Copied

I thought of that too, but as far as I know actions are only to bet set at OnEnter, OnExit (which is a bit useless) and "OnClick" (on a button). How to I set an action at the end of a slides timelime?

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
Community Expert ,
Mar 07, 2019 Mar 07, 2019

Copy link to clipboard

Copied

Best way is with shape button on master slide.

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
Participant ,
Mar 07, 2019 Mar 07, 2019

Copy link to clipboard

Copied

OK, thanks for another way to make slides stop at the end, but still my problem is, how to toggle my button into "play mode" when the slide stops at the end.

I´m lacking for a solution to detect that the project is stopped at the end (either by a smartshape from the master slide or an invisible click area or button). You wrote about another action script, but I do not know which and where to assign this script. As far as I know, the play/pause button already detects if the project is paused or not. But even assigning a script to the OnEnter does not help. If I assign a detetction script at OnEnter, the button changes at the beginning of the slide, not at the end!

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
Community Expert ,
Mar 07, 2019 Mar 07, 2019

Copy link to clipboard

Copied

All Captivate interactivity is Event-Based.  This fact cannot be over-emphasized enough.  Every action must be triggered by some event.  The only event available when you reach the end of a slide is the On Exit event.  But that isn't going to fire if you have paused the slide BEFORE the final frame by having a button on the Master Slide.

If you want a reliable way to ensure your custom play/pause button remains in sync with the current play/pause status you need to have a tracking variable set up to record a value so that any action which pauses the timeline also performs a parallel action that assigns a corresponding value to the tracking variable as well. 

But as I said, your actions can only be executed via screen events. That includes the ON Slide Enter and ON Slide Exit events, in addition to ON Click and some other events that are unique to specific Interactive Objects.

However, in case you were hoping to use the CpCmndPause variable as the tracking variable in your conditions, you need to realise that this is no ordinary system variable but is in fact a COMMAND variable, because assigning a value to it is actually a way of executing  a command or action (e.g. Pause or Play).  Try to display the value of these Command variables inside a text object by inserting them and you will find that there is no option under the Insert dropdown to select these particular system variables.  They are not listed for display. Try to use the trick of surrounding the name of the Command variable with double dollar signs (e.g. $$CpCmndPause$$) to make it display and you will find that it does not work.  And although you can add them as variables in the decision blocks of Conditional Advanced Actions, they do not appear to influence the decisions in any reliable way.  You're better off using a custom tracking variable to create your toggle action and change the state of your custom button so that it looks similar to the default playbar button.

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
Participant ,
Mar 07, 2019 Mar 07, 2019

Copy link to clipboard

Copied

Hi Rod,

thanks for your detailed answer, I really appreciate it 🙂

What you wrote spoke out of my heart, specially "If you want a reliable way to ensure your custom play/pause button remains in sync with the current play/pause status you need to have a tracking variable set up to record a value so that any action which pauses the timeline also performs a parallel action that assigns a corresponding value to the tracking variable as well." I guess that´s the only way to get my button working as it should, but on the other hand that seems to be my major problem as I do not know how! In the meantime I realized by myself that the CpCmndPause does not work for a detection wether a slide stops at the end. It works fine if used as an OnEnter, but that´s not the point.

By now I took a quick and dirty solution and placed a copy of my play button above the pause button on every slide that stops at the end ... Not nice, not smart, but I do not know how to create an elegant action script solution

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
People's Champ ,
Mar 07, 2019 Mar 07, 2019

Copy link to clipboard

Copied

The only way I know how to do this is to use JavaScript, and I do this in all of my courses.

You need to use the ONSLIDEENTER and the CPVARIABLEVALUECHANGE listeners to detect the end of the slide.

The following JavaSCript can be put into an Advanced Action. When the slide gets to withing 5 frames of the end you can hide the topmost button.

window.cpAPIEventEmitter.addEventListener( 'CPAPI_SLIDEENTER', endSlide, false );

function endSlide( e )

{

window.cpAPIEventEmitter.addEventListener( 'CPAPI_VARIABLEVALUECHANGED', function ()

{

runTimer( e.Data.to );}, 'cpInfoCurrentFrame'

);

}

function runTimer( end )

{

console.log(window.cpInfoCurrentFrame)

//check if 5 frames from the end-of-slide

if ( window.cpInfoCurrentFrame > end - 5 )

{

cp.hide("t0pbuttonName");

}

}

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
Engaged ,
Mar 07, 2019 Mar 07, 2019

Copy link to clipboard

Copied

To spin on Rod's thoughts about the tracking variable...

Since CpCmndPause does not work, you'll need some means of tracking play/pause state.

One way could be to query cp.movie.paused (a method from Captivate's JavaScript API), as this holds the current state at all times as a Boolean (true if the slide is paused; false if it's playing), regardless by what means the slide was paused or resumed.

If you create a user variable - say v_slidePaused  - and run this line of js from an advanced action:

v_isPaused = cp.movie.paused;

...you can then add conditional stuff to the same advanced action, based on whether v_isPaused is true (slide is paused) or false (slide is playing).

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
People's Champ ,
Mar 07, 2019 Mar 07, 2019

Copy link to clipboard

Copied

That won't work because you need some way of asking the question of the variable value continuously.

Without JS, you  can only poll the variable based on some event available in Captivate. That's why the variable value changed listener is so valuable to check the value of anyvariable everytime the cpInfoCurrentFrame changes.

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
Community Expert ,
Mar 07, 2019 Mar 07, 2019

Copy link to clipboard

Copied

Was on a flight. Is your problem solved?

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
Participant ,
Mar 08, 2019 Mar 08, 2019

Copy link to clipboard

Copied

Thanks Gaanf, TLCMedia, Lilybiri and Rod,

that´s quite heavy stuff for me, but I will give it a try and be back later!

I guess the solution might come in handy for many other users as well

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
Community Expert ,
Mar 08, 2019 Mar 08, 2019

Copy link to clipboard

Copied

LATEST

Will try to screen the whole thread, got to my destination in US.

I understand you are now overwhelmed with information. I tried to read everything (did so yesterday but on phone in between travelling).

It is a little bit contractidory what you want to do. You provide a Play/pause button to give control to the user, but at the same time you do take control by pausing the slide at its end.  Hope you understand why I feel this  to be two opposite actions.

Rod explained that the advanced/shared actions are event triggered. I posted a full list with all possible events for those actions in a blog post:

Importance of Captivate's Events? - eLearning

The slide events mentioned in that post occur automatically: On Enter and On Exit. The other events need an interaction of the learner to trigger the action.  THe limitation in Captivate is that it doesn't have a 'frame event'. That is the reason why TLCMediaDesign proposed to use JS which has such an event. Of course that make it a bit more complicated. You can just try to copy/paste the JS provided by David, he is a great JS expert. It will be the most foolproof solution if you want to keep your workflow.

It is not possible to use the Delay Next command to change the state of the button when the pausing point is reached at tend of the slide, because the learner could have clicked the Pause button, and the Delay command doesn' stop running when such a pause occurs.

Maybe I could find a workaround, with some calculations using the cpCmndCurrentframe variable but I don't find it worthwhile to put time in it for the reasoe explained about the contradiction (my pedagogical background) and the fact that JS is a better solution in that particular use case.

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
Resources
Help resources