Intro
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
View the example using this link for a scalable project, or this fixes resolution embedded one.
Setup
Progress indicator
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)
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:
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.:
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, pleasevar perc = window.cpAPIInterface.getVariableValue(“v_perc”);
window.cpAPIInterface.setVariableValue(“v_perc”,perc.toFixed(0));
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?