11 Replies Latest reply: Sep 27, 2012 8:10 AM by candygrin RSS

    Jump to Slide revisited for Captivate 5

    pcapademic Community Member

      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?

        • 1. Re: Jump to Slide revisited for Captivate 5
          Jim Leichliter Community Member

          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

          • 2. Re: Jump to Slide revisited for Captivate 5
            pcapademic Community Member

            Thanks for the reply, Jim.

             

            I have a couple of use cases. In one use case, the second video is launched in the same window, and the student doesn't really know that some second video is playing - the student has the experience of watching an interactive video, and I have modular video content, analogous to writing a function in shared library.

             

            In the other use case, an online help system opens a new window to play an excerpt from the training video.

             

            Of course, the primary use case of the videos is where each tutorial stands alone, can be passed around as an intact thing, and can be served from a "Training Videos" page. The primary use case requires that each video have a title page and some introductory content. It is these several beginning slides I am trying to exclude from the viewing experience when the video is launched from someplace other than the "Training Videos" page.

             

            With regards to the code snippet, the code I showed was code from the linked forum discussions, was intended to be part of an advanced action that got activated "on enter" of the first slide. The point is that the "cp.cpEISetValue('cpCmndGotoSlide',slideNumber-1); and cp.cpEISetValue('rdcmndResume',1); lines don't seem to be working.  I can get an alert() call to work via the advanced action mechanism, but not the "goto slide" functionality.

             

            Once I get some code that jumps to the desired slide, I was going to see what I needed to do to pass a number to the "goto slide" function.

             

            I'm not wedded to javascript. In fact, it might be better to use actionscript and keep everything internal to .swf file. It's just that, when I searched the forums, the javascript solution was the only one I found, and, unfortunately, it didn't work. And, while I only know a little javascript, I don't know any actionscript, and the syntax is kind of funky.

            • 3. Re: Jump to Slide revisited for Captivate 5
              Jim Leichliter Community Member

              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

              • 5. Re: Jump to Slide revisited for Captivate 5
                Ju.Rmt

                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.

                • 6. Re: Jump to Slide revisited for Captivate 5
                  Jim Leichliter Community Member

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

                  • 7. Re: Jump to Slide revisited for Captivate 5
                    candygrin Community Member

                    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

                    • 8. Re: Jump to Slide revisited for Captivate 5
                      Jim Leichliter Community Member

                      Yes, relative paths are possible.

                      • 9. Re: Jump to Slide revisited for Captivate 5
                        candygrin Community Member

                        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...

                        • 10. Re: Jump to Slide revisited for Captivate 5
                          Jim Leichliter Community Member

                          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);
                                    }
                          }
                          
                          
                          • 11. Re: Jump to Slide revisited for Captivate 5
                            candygrin Community Member

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