Using JavaScript to trigger a slide's On Enter Advanced Action for a Replay Button
Hello,
Prelude: My project needs a Pause/Play button and a Rewind button. I am creating a project in Captivate 2017 where each slide needs to play to the end of the slide before the on screen buttons are enabled on the user's first visit. On the second visit, everything needs to be enabled at the beginning of the slide. I tried using Conditional statements where on the first pass, everything is Disabled in the On Enter Advanced Action, then after a Delay Next Action By action everything is enabled. Because my project has a Pause/Play, the inability to control the Delay Next Action By action with a Pause command means that I am now trying to use JavaScript timers with my On Enter Advanced Action that will enable the interactions when the timers run out.
With my Replay button, I am able to go back to the beginning of the slide with an Advanced Action like this:
But this only brings me to the first frame of the slide and does not trigger the slide's On Enter Advanced Action again, meaning that the Javscript for the timers are not triggered again, which would reset the timers for me.
Question: I have looked into JavaScript where you can use the line cp.runJavascript(cp.model.data.objectname.oca); to trigger an Advanced Action on a slide's object, but is there a way to run the JavaScript for the slide's On Enter Advanced Action using a similar line of code? I am hoping to add something with that functionality as an Execute Javascript action to the above Replay button Advanced Action, so it will jump to the initial frame of the slide, and also trigger the On Enter Advanced Actions, so that on a first visit, everything will still function how I need it to. If that makes sense.
I also found the below code that would allow me to find the slide's ID, which I was hoping I could put into the cp.runJavascript(); code and it would trigger the On Enter Advanced Action, but I have not been able to make that work either.
var getSlides = cp.model.data.project_main.slides;
var currentSlideID = getSlides.split(",")[window.cpInfoCurrentSlide - 1 ];
cp.runJavascript(cp.model.data.objectname.oca);
I have also seen where you go to the use a v_enter variable that is set to the slide's first frame, then when you click Replay, it jumps to a few frames before the current slide's initial frame, then plays again so it will actually trigger the On Enter Advanced Action, but that creates a flicker when the slide has to reload again from the previous slide, which I cannot have in my final product.
Any guidance would help. I have exhausted so much time trying to find a solution to this issue, and every time I find a semblance of a solution, something about it doesn't seem to work 100%.
Thank you,
Sean
