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

How execute a advance action at the end of slide?

Guest
Feb 11, 2017 Feb 11, 2017

Copy link to clipboard

Copied

Hello,

Please tell me how to How execute a advance action at the end of slide in captivate?

Views

1.6K

Likes

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 ,
Feb 11, 2017 Feb 11, 2017

Copy link to clipboard

Copied

There is an On Exit event for slides, but I really do not recommend to use it unless you are totally sure that the last frame of that slide will always be visited, and after extensive testing. Have a look at:

Events and (advanced) Actions - Captivate blog

Personally I rarely use that event to trigger an advanced or shared action, especially for navigation I will prefer the On Enter event of the following slide. If you gave more details about which action you want to execute, could offer more recommendations.

Likes

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 ,
Feb 11, 2017 Feb 11, 2017

Copy link to clipboard

Copied

You can do this with JavaScript utilizing the CPAPI_VARIABLEVALUECHANGED event listener while monitoring the cpInfoCurrentFrame variable.

The advanced action needs to be attached to some object to work. I created an invisible smartshape named "action_1" where the number indicates the slide number. make it 4x4 pixels, double-click, put it in a corner or the slide, no hand cursor.

You can then put one on any slide you need to use it by attaching an advanced action and changing the numberin the name to match the current slide, i.e. "action_2", "action_10"

This script will need to be put in the head of the index.html.

var interfaceObj, eventEmitterObj, slideEnterData;

window.addEventListener( 'moduleReadyEvent', function ( e )
{
interfaceObj = e.Data;
eventEmitterObj = interfaceObj.getEventEmitter();
initializeEventListeners();
});

function initializeEventListeners()

if ( interfaceObj )
{
  if ( eventEmitterObj )
  {
   eventEmitterObj.addEventListener( 'CPAPI_SLIDEENTER', function ( e )
   {        
    slideEnterData = e.Data;  
    eventEmitterObj.addEventListener( 'CPAPI_VARIABLEVALUECHANGED', runTimer, 'cpInfoCurrentFrame' );   
   });
  }
}
}

function runTimer( )
{
if ( window.cpInfoCurrentFrame == slideEnterData.to - 1 )
{
  cp.runJavascript( cp.model.data[ 'action_' + slideEnterData.slideNumber ].oca )
}
}

Likes

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
New Here ,
Apr 14, 2021 Apr 14, 2021

Copy link to clipboard

Copied

Hi! This seems like the solution I need. Does the smart shape need to be converted to a button to attach the advanced action?

Likes

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 ,
Apr 15, 2021 Apr 15, 2021

Copy link to clipboard

Copied

Yes, it does need to be a button.

 

I would probably do this a little differently now. But this should still work.

Likes

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 ,
May 11, 2021 May 11, 2021

Copy link to clipboard

Copied

LATEST

I have used this approach quite a lot and find it's a really easy way to work. Typically, for functionality that I want to use throughout the project, I make an invisible button at 1px x 1px, put it on the first frame of my file and ensure that it's set to be viewable accross the whole project.

If you don't do that and people come back after leaving the project and resume where they left off, it'll be broken.

Then I'll use naming conventions where particular objects on a slide can be predictably accessed ie: s25_mso might reference a multistate object on slide 25 ... and so on.

Then all that needs to be done is isolate the current Slide No to employ the control.

 

 

Likes

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 ,
Feb 11, 2017 Feb 11, 2017

Copy link to clipboard

Copied

Generally I will execute an advanced action that I need to run on exit through my go to next slide button. For example, I have a template with a custom table of contents I need to close every time someone exits a slide.  Instead of simply going to next slide just add your advanced actions before the next slide command and you are ok. If your advanced action is conditional just add the go to next slide command at the end of your on condition action as well as your ELSE actions. 

Paul Wilson, CTDP

Likes

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 ,
Feb 12, 2017 Feb 12, 2017

Copy link to clipboard

Copied

Paul, you talk about an action that is triggered by a button, not about an advanced action that is executed (automatically) On Exit for a slide. The user needs to click on the button to have this action done. It will not be done when leaving the slide, after the last frame, but on the frame defined by the pausing point of the button.  In that case the On Exit event of the slide doesn't occur at all as I explain in detail in the blog post about events. More info about the pausing points vs a Pause command triggered by a slide event in:

Pausing Captivate's Timeline - Captivate blog

Captivate has at this moment no event 'on leaving the slide', which is not the same as 'on exit'.

Likes

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 ,
Feb 12, 2017 Feb 12, 2017

Copy link to clipboard

Copied

Thanks for your concern but I was not talking about a single action. My course designs do not use the inbuilt Playback Control nor do they use the inbuilt Table of Contents. Instead, I create my own. Because of this, I cannot use a single action for any button that navigates away from any slide. Instead, I have created several advanced actions that contain the Go to Next Slide command but also contain the other actions that I need to be performed. Here you can see an example of that for the Next button on a slide from a recent course I am developing. I still call them Goto_Next_Slide but the advanced action takes care of some additional housekeeping that needs to occur. 

2017-02-12 12-53-46 PM

Yes, these advanced actions are not being run on the final frame of a slide but since my navigation controls are the only way a user is going to exit one of my slides, for all intense purposes they are the last frame of that slide the end user will ever see. To me, this is the simplest way to achieve this and to guarantee that the set of actions runs. This works very well and is fully tested on many courses.

Paul Wilson, CTDP

Likes

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 ,
Feb 12, 2017 Feb 12, 2017

Copy link to clipboard

Copied

Why is this an answer to the OP 'How to execute an advanced action at the end of the slide'? This is an explanation of your setup of a course, not how to execute an action when exiting a slide. David gave a JS answer, I offered an answer about the On Exit event, with its limitations. Sorry, I don't understand your answer, always use custom controls myself. What you explained needs a user interaction, clicking on that button, it is not an advanced action triggered by exiting the slide.

Likes

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 ,
Feb 12, 2017 Feb 12, 2017

Copy link to clipboard

Copied

Lieve, I'm just offering a possibility for the OP to consider. Why not simply let the OP decide what suggestion meets their needs?

Paul Wilson, CTDP

Likes

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