Skip navigation
Currently Being Moderated

Jump to Slide revisited for Captivate 5

Apr 29, 2011 12:45 PM

I've found two forum discussions on the topic, but I can not get the offered code to work for me. Re: Jump to slide in a new project [for Cap 4] offered a solution that was revisited in Re: Got code to work in Captivate 5. The offered solution for Captivate 5 was:

 

if ( window.location.href.indexOf('?slide=') != -1 ) { 
  var slideNumber = window.location.href.substring(window.location.href.indexOf('?slide=' )+7);
  var cp = document.getElementById('Captivate');
  cp.cpEISetValue('cpCmndGotoSlide',slideNumber-1);
  cp.cpEISetValue('rdcmndResume',1);
}

 

I could not get this to work. I even tried a simplified version:

  var slideNumber = 4;
  var cp = document.getElementById('Captivate');
  cp.cpEISetValue('cpCmndGotoSlide',slideNumber-1);
  cp.cpEISetValue('rdcmndResume',1);

 

It didn't do anything (and yes, I was running the .htm and .swf from a web server, not just using the preview). Finally, based on http://captivatedev.com/series/captivate-javascript-series/, I tried

var slideNumber = 4;
var objCP = document.Captivate;
objCP.cpEISetValue('rdCmndGotoFrame',slideNumber);
objCP.cpEISetValue('rdcmndResume',1);

 

This code caused the player to jump to some internal slide (presumably slide 4), but the player only displayed a greyed-out page and did not play.

 

I'm at an end of my rope. Here is what I'm actually trying to do:

 

I have some short tutorials, already created, they work fine. I want to create a new tutorial that provides some context and then launches the previously created tutorials on an arbitrary slide. A nice to have would be for the short tutorial to figure out that it was started by another swf video (rather than by a direct link), and then exit back to the aggregating tutorial.

 

Any ideas how to get either function/feature to work?

 
Replies
  • Currently Being Moderated
    Apr 30, 2011 1:07 PM   in reply to pcapademic

    Hi pcapademic,

     

    So help me understand here.  You have a course that acts like a launching pad for other short tutorials.  You want to be able to click a link / button in that course and jump to a specific slide in your short tutorial.  Would this short tutorial be launched in a new window or the same window as your running course?

     

    The first segment of code you have listed is only half the story:

     

    if ( window.location.href.indexOf('?slide=') != -1 ) { 
      var slideNumber = window.location.href.substring(window.location.href.indexOf('?slide=' )+7);
      var cp = document.getElementById('Captivate');
      cp.cpEISetValue('cpCmndGotoSlide',slideNumber-1);
      cp.cpEISetValue('rdcmndResume',1);
    }

     

     

    What does the button URL that launches the short tutorial look like?  Something like this?

    http://www.mySite.com?slide=7

     

    Once that URL is launched, the code snippet above should find the ?slide=7 parameter in the URL and direct your short tutorial to the corresponding slide.  This code snippet should exist in the .htm wrapper of the short tutorial.

     

    To jump back to the main course, the Learner can simply close the launched window.  Or you can provide another button in the short tutorial that will jump back to the main course using this same method.

     

    Hope that helps,

     

    Jim Leichliter

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 30, 2011 6:06 PM   in reply to pcapademic

    I've got a free widget that allows you to show a web page inside of your Cp project.  This may help with the videos:

    http://captivatedev.com/2010/11/05/adobe-captivate-5-web-page-widget/

     

    I'll whip up a tutorial on my blog.  You aren't the first person to have asked this question.  I'll post a live demo and a sample you can download.

     

    Jim Leichliter

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 30, 2011 8:48 PM   in reply to pcapademic

    Take a look at this tutorial and see if it helps:

    http://captivatedev.com/2011/05/01/how-to-jump-to-a-specific-slide-in- a-separate-course/

     

    Jim Leichliter

     
    |
    Mark as:
  • JulieRchmt
    6 posts
    Nov 13, 2011
    Currently Being Moderated
    Mar 15, 2012 6:22 AM   in reply to Jim Leichliter

    Hi Jim,

     

    could you please please please provide me / us with the last 2 links you wrote in these previous emails? (they are not working right now)

     

    thanks a lot

    J.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 15, 2012 3:22 PM   in reply to JulieRchmt

    @JulieRchmt:  Sorry... my ISP must have been down.  The links should be fine now.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 7, 2012 11:30 AM   in reply to Jim Leichliter

    Hey Jim,

    If you're still checking this, is it possible to use your JS method with a relative path?
    example
    ../CourseNamePart2/CourseNamePart2.htm

     

    so then with your method my getURL should be

     

    ../CourseNamePart2/CourseNamePart2.htm?slide=44

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 7, 2012 11:53 AM   in reply to candygrin

    Yes, relative paths are possible.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 8, 2012 7:00 AM   in reply to Jim Leichliter

    Everything is set up the way you exampled. My secondary project links back to the first project fine, but it never jumps to the appropriate slide.

     

    Is it necessary to run the courses of a web server to have the relative pathing work?

     

    The other thing I was thinking is I need to jump to slide 44. I have the timer set to 3 seconds. Is that not enough time maybe?? I don't really want the learner to have to wait more than 3 seconds though...

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 8, 2012 8:56 AM   in reply to candygrin

    The article is old and I have found a better way of handling slide jumps.  Captivate 5.x will call a JavaScript function called cpSlidesAllLoaded() when all of the Captivate slides have loaded into memory.  I would define that function in your JavaScript.  So here is an UNTESTED JS dump that should handle reading the URL parameter and make the jump after all slides are loaded into memory.  This is 100% more reliable than using setTimeout():

     

    function cpAllSlidesLoaded(){
              var cpObj = document.Captivate;
     
              if(window.location.href.indexOf('?slide=') != -1) { 
                 var startIndex = window.location.href.indexOf('?slide=' ) + 7;
                 var URL = window.location.href.toString();
                 var slideNumber = URL.substring(startIndex);
              }
     
            if(slideNumber != '' && slideNumber != null) {
                        cpObj.cpEISetValue('cpCmndGotoSlideAndResume', slideNumber - 1);
              }
    }
     
    
     
    |
    Mark as:
  • Currently Being Moderated
    Sep 27, 2012 8:10 AM   in reply to Jim Leichliter

    Thanks so much for this! Sorry it took so long to reply.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points