loading

Start exploring to learn more about me and my passion for technology in education
learn more

Captivate – Go to next slide in Javascript

Whilst recently converting a Captivate 9 elearning project to use xAPI, I wanted to capture custom verbs for the xAPI. I came across this great article that makes it easy to use. So I won’t repeat it here, just go check it out!

Captivate Javascript xAPI Customization | Best Practices for xAPI

With the new Tin Can object being passed, I wanted to redirect the user to a another page based on the object they clicked on, almost like branching but I wanted to capture this.

So I set about updating all the javascript and used the following as an executable javascript on the Action item of each object

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
var tincan = new TinCan({url: window.location.href});
 
 
 
//Change this only
/*****************************************************/
 
var slideTitle = " Title";
var NextSlide = 0;
 
/*****************************************************/
 
tincan.sendStatement(
{
verb: {
id :"http://maywebsite.com/elearning/clicked.htm",
display: {"en-US":"clicked"}
},
object :{
id: "http://maywebsite.com/elearning/multiscreen.html",
definition :{
name: {"en-US": "Viewed " + " " + slideTitle},
description: {"en-US": "Clicked and Viewed the " + slideTitle }
}
 
}
}
);
 
window.cpAPIInterface.setVariableValue('cpCmndGotoSlide',NextSlide);

This all worked with the new clicked statement working but the redirect was going to the wrong page. I know I was linking to the number of the slide in captivate, so why wasn’t it working.

Then it dawned on me that I need to reference the object number, not the slide number. So instead of counting the first slide as 1, you count it as 0 (zero), and all will work as planned!

 

Leave a Reply

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.