Skip to main content
Participant
February 23, 2017
Answered

Struggling with java/Captivate/new LMS

  • February 23, 2017
  • 1 reply
  • 1027 views

Hi,

For years, we've used a small piece of java at the end of our software simulations produced in Captivate.  When the user clicks this, they advance to the next page in the main e-Learning course (developed in Composica):

setTimeout(function() {

Navigation.next();

}, 100);

We've recently moved to Articulate Storyline 2 for e-Learning development, and the old code doesn't work.  From searching online, I found this discussion https://community.articulate.com/discussions/articulate-storyline/web-object-how-to-advance

I created the variable within Storyline, and the trigger.  In Captivate (7.0.1) I am now using the code:

var player=parent.GetPlayer();

var currentTime = new Date();

var uniqueTime=currentTime.getTime();

player.SetVar("goNext",uniqueTime);

Taken from this website: Web Object..how to advance - Articulate Storyline Discussions - E-Learning Heroes

The problem I am now experiencing, is that when the course is published to 'CD' from Storyline, the code works perfectly in both SWF and HTML5 outputs.  If I publish to a spare webserver/FTP I have, then the SWF based content also works perfectly - HTML5 doesn't load but that's another issue.

However, when I publish to SCORM 2004 in Storyline, this breaks my Captivate SWFs, and they do not advance to the next e-Learning slide when the button is clicked.

I've read this may be due to the LMS/SCORM package not interpreting the javascript from Captivate correctly.  This discussion Javascript Print Code won't work on LMS/SCORM mentions the need for separate javascript, possibly including "window.cpAPIInterface."

Can anyone see/suggest a quick fix to my current Captivate code to allow for it to work with a SCORM-compliant LMS?

Thank you for any help you can offer.

Message was edited by: Joe Boss

This topic has been closed for replies.
Correct answer TLCMediaDesign

It sounds like you have a parenting issue. In an LMS, usually the course rides in another page in a frame which has the SCORM API wrapping the course.

You need to set up a console.log to see the value of player.

add this script in the Captivate file where it is executing the JavaScript.

console.log(GetPlayer(),parent.GetPlayer(),parent.parent.GetPlayer())

Put that line before any other scripts. Press F12 and select the console tab and see what the output is. There should be 3 different putputs and it's possible that an error is being thrown if you are trying to execute script based on the variable "player" if it is undefined.

1 reply

TLCMediaDesign
Inspiring
February 23, 2017

Not sure how you actually have this setup? How is the Captivate inserted in Storyline?

Haven't worked in CP7 for some time, but I do not believe the cpAPIInterface object is available in that version. The code then needs to determine whether it is swf or HTML5 and make the code adjustment from there.

joe_bossAuthor
Participant
February 23, 2017

Hi thanks for the quick reply.

In Storyline 2, on the Slide Master, I have a text variable named goNext.  I then have a slide trigger, 'Jump to next slide when goNext changes'. This is in line with the code on a previous link.

The Captivate has a couple of slides, the last of which has a clickbox, that triggers the goNext javascript mentioned earlier.

In this test environment,  I've inserted a Flash SWF file, created from the Captivate above.  This is a simple Storyline 2 test project with a few slides.  The SWF is on 1.1, the next page (1.2) has a text box just to confirm it's jumping to the next slide properly.  Later on in the project (page 1.3), I've published the same content from Captivate, but this time as HTML5.  Accordingly in Storyline, I've inserted this as a Web Object.

If I publish to CD, and run the .exe, it all works beautifully.

If I publish to web, and upload to a standard FTP, the SWF versions work absolutely fine, the HTML5 just shows a brief spinning loading, then doesn't display the animation.

If I publish to SCORM 2004 then upload, the SWF loads and I can navigate through, but I can't complete the final action that would trigger the javascript (nothing happens).  The HTML5 animation doesn't load.

Hope that clarifies.

Thanks

Joe

TLCMediaDesign
TLCMediaDesignCorrect answer
Inspiring
February 24, 2017

It sounds like you have a parenting issue. In an LMS, usually the course rides in another page in a frame which has the SCORM API wrapping the course.

You need to set up a console.log to see the value of player.

add this script in the Captivate file where it is executing the JavaScript.

console.log(GetPlayer(),parent.GetPlayer(),parent.parent.GetPlayer())

Put that line before any other scripts. Press F12 and select the console tab and see what the output is. There should be 3 different putputs and it's possible that an error is being thrown if you are trying to execute script based on the variable "player" if it is undefined.