Percentage Progress Indicator (non-linear course) - solution 2

Intro

Recently I posted a first solution on my under this link.  It works fine, has a simple logic but something is bothering me: the percentage of viewed slides appears at the first frame of the slide which  is already included in that percentage.  It would be nice if only the percentage of the already viewed slides were shown. 

I hear some suggesting: use the On Exit event instead of the On Enter event. Logically? However that event is not to be trusted and . Consequence:  the frames in the inactive part of the interactive object are not visited. On Exit event happens after the last frame, which needs to be visited. Too bad, there is no ‘when leaving slide’ event, which would solve the problem. Hence this solution which is a little bit more complicated than the first solution.

Example file

I used the same 19 slides from the Quick Start Project ‘League’ as in the first example. The Table of Content is added to allow non-linear navigation. The option ‘Navigate to visited slides only ‘ is NOT checked to enable completely free sequence of slide views. The default playbar of this project is available, you can also scrub with the progress bar. But the progress indicator will only be updated when entering a slide. It is stil a slide-based indicator, not a frame-based nor time-based one.

View the example using this link for a scalable project, or this fixes resolution embedded one.


Setup

Progress indicator

Similar to the first solution, I used a text shape to show the value of a variable (v_perc) indicating the percentage slides already viewed when entering the present slide.  This text shape has a second state, labeled ‘Last’ which will appear on the last slide to be viewed:

This progress indicator has been inserted on the first slide, displayed for the rest of the project, always on top. However it will be hidden on the first slide by the On Enter action 'EnterFirst', because no slides are viewed yet.

Variables

Each slide  needs a slide tracking variable, user defined of the Boolean type. Start value is set to 0. Variable names are not important, I labeled them v_1 v_2,…..v_19 because it is easier to link them to the slides.  Boring work, sure but I always have a shared action ready in an external library with a bunch of variables and import them using the trick 1 explained in Rare tips for Shared Actions. For all slides except the first one,  Boolean will be toggled to 1 when visiting the slide for the first time. First slide doesn’t need a progress indicator on the first visit, since no slide have been viewed yet. The tracking variable v_1 will be used in the another action, to make the indicator visible on later visits.

Total number of visited slides will be stored in another user variable v_total, also starting with 0 as value.

A variable v_last will be used to detect if the active slide is the last slide to be viewed. This variable was not needed in the first solution.

The percentage viewed slides, which is displayed in a text shape (red) inserted on the first slide and timed for the rest of the project, is stored in the user variable v_perc.

The system variable cpInfoSlideCount will be used as well, its value is the total number of slides.

Events and actions

Enter event first slide: EnterFirst (advanced action)

That first slide can never be the last slide to visit, but on the first visit it shouldn’t show the Progress Indicator, since no slide has been viewed yet. Use the tracking variable v_1 for this conditional action:

Success event of the Start button on the first slide: StartAct (advanced action)

A short advanced action to make the ProgressIndicator visible after going to the Next slide.

Enter event of all slides (except first): PercCalcLast (Shared action)

This shared action has two decisions:

The first decision is similar to the one described in my first blog. One exception: the variable v_last is calculated from the user variable v_total (number viewed slides) and the total number of slides in the project ‘cpInfoSlideCount‘.

This calculated variable is used in the second decision. If it is equal to 1, the active slide is the last slide to be viewed. In that case the Normal state of the Progress Indicator is replaced with the Last state (warning about last slide), and the variable v_perc is set to 100%, will not change anymore during the session. The Else part is necessary to reset the state to Normal, so that later visits to any slide will show the progress in % (100%) again. 

Description of the 4 parameters, only the first parameter is different on each slide:

The Javascript, same as for solution 1,  is needed to format the percentage to no decimals.:

var perc = window.cpAPIInterface.getVariableValue(“v_perc”);

window.cpAPIInterface.setVariableValue(“v_perc”,perc.toFixed(0));

Tip: be careful when copy/paste this script, because the punctuation marks may not be pasted correctly if you are using another keyboard than my Belgian AZERTY one. Double-check them, please

More?

The logic behind this solution can also be used to show a progress bar, which takes into account the visited slides instead of the default playbar which is just jumping around when navigation is not sequential. Of course you can also show the number of viewed slides instead of a percentage. Maybe you have more ideas?


Percentage Progress indicator (non-linear course) - Solution 1

Goal

All tutorials about showing progress as a percentage have the same limitation: you need to view the course in a linear way, no branching or other non-linear navigation. Even in the TOC the indicated Time at the bottom is supposing you are in a linearly visited course. In the TOC the checkmarks at the slides are the only way to see which slides have been visited in a non-linear course, there is no real progress indicator. Recently someone asked (again) for a progress indicator (percentage) that would be functional in a non-linear course. 

I have created two possible solutions, All is slide-based, which is the reason for the two solutions:

  1. Easiest solution will show the % on each slide, but not after having viewed the slide, but when entering the slide.
  2. More perfect solution will show the percentage after having viewed the slides. Bit more complicated.
A bunch of Boolean variables and one shared action are what you need in both cases. In the second case I needed one very short advanced action as well. JS was necessary as usual to format the percentage display (no decimals, but can easily be changed). This post will explain the first (easy) solution.

Example

I took 19 slides out of the Quick Start Project ‘League’ and didn’t edit them with the exception of the Title slide. They are just used for testing the workflow. The default playbar, with its progress bar has been preserved. That is meant for comparison with the custom progress indicator. To allow you to navigate to slides in a non-linear way, I added the Table of Content, with navigation allowed. It is in Overlay, with the default Expand and Collapse buttons. Feel free to click in any sequence, and watch the progress indicator. I choose 19 slides, not 20 to show that it is possible with any amount of slides, even odd numbers. Here is a link to the scalable version:

Progress indicator for non-linear course

Or you can watch the embedded version (fixed resolution):


Setup

Variables

Each slide needs a slide tracking variable, user defined of the Boolean type. Its start value is set to 1. Variable names are not important, I labeled them v_1, v_2,…..v_19 because it is easier to link them to the slides.  Boring work, sure but I always have a shared action ready in an external library with a bunch of variables and import them using the trick 1 explained in Rare tips for Shared Actions. Each Boolean will be toggled to 1 when visiting the slide for the first time.

Total number of visited slides will be stored in another user variable v_total, also starting with 0 as value.

The percentage viewed slides, which is displayed in a text shape (red), inserted on the first slide and timed for the rest of the project, is stored in the user variable v_perc.

The system variable cpInfoSlideCount will be used as well,which stores the total number of slides.

Events – Shared Action ‘CalcPerc’

That shared action is triggered 19 times, with the On Enter event of the slides:

The Shared Action is straightforward and needs only one parameter: the slide tracking variable:

The JS is needed to avoid too many decimals for the calculated percentage:

var perc = window.cpAPIInterface.getVariableValue(“v_perc”);  window.cpAPIInterface.setVariableValue(“v_perc”,perc.toFixed(0));

The second solution where the progress will show the percentage viewed slides more correctly will be posted in another article, with its example file.