Copy link to clipboard
Copied
Hello,
In short, I would like to loop through the slides on a user interaction, find the slide with a particular label/title, get its corresponding slide number, and jump to that particular slide number.
I know how to find the correct slide object on the cp.model.data object, but this slide object doesn't seem to have the slide number on it.
Any help will be appreciated!
Copy link to clipboard
Copied
Does it have to be by JS? With an action you can jump to a slide using its label or its number.
Copy link to clipboard
Copied
Really? Didnt know this... i knew you could use a number. Ill have to look
at this later...
Copy link to clipboard
Copied
I am a labeling freak and always label slides and most objects. I never use a slide number in any action. At the same time you already have labels that will be used in the TOC, which I'll use in most projects and prefer over a playbar for navigation reasons.
Although I appreciate JS in some circumstances (like using an array, formatting a number, having a random number) there is quite a lot that can be done with advanced or shared actions that is much easier, at least if you are not a great programmer like TLCMediaDesign
Copy link to clipboard
Copied
Hi Lilybiri,
I think there may have been a misunderstanding. I know that you can jump to a slide number / label with an action, but I would like Captivate / JS to dynamically figure out what that slide is.
Scenario - I have a button on my master that should always take the user to a slide with the label "Reference" when they press it. The issue is that as I work on my project the slide number for this "Reference" slide is always changing, and I dont want to have to adapt the action each time. Instead, I want JS to loop through the slides, figure out where the slide with the label Reference is, and then take the user there. Once I set that up, I'll never have to adapt any actions again and can use the same code over different projects.
I know how to do this, though, with some help from TLCMediaDesign. : )
Copy link to clipboard
Copied
That is exactly the reason why I never use a slide number in any advanced action. The slide label will never change. This means that 'Jump to Reference' command on the master slide will always navigate to the correct slide, whatever its slide number is. AFAIK there is no misunderstanding at all on my part. I just found it very cumbersome to have to write a looping JS for such a pretty simple work flow. KISS is one of my motos, and this is clearly a situation where advanced actions are much easier.
Copy link to clipboard
Copied
Oh, ok. Then I guess I do not know how to jump to a slide by using the label. When I click select "Jump to Slide" On Success, the drop down box below gives me a selection of slides. I always thought when I chose one, the action is bound to that slide number. Or is it bound to the label?
Copy link to clipboard
Copied
It's bound to that specific slide. If after creating the action you move the slide do a different position in the slide order, the action is updated to still point to that same slide. If you change the label, the action is updated to show that new label.
The same principle applies to objects that you reference in an action.
Copy link to clipboard
Copied
Ok. Got it. Thanks!
Copy link to clipboard
Copied
Only place where you have to be careful is for D&D objects: do not change the names of the objects after creation of the D&D because you'll lose the links between Drag sources and Drop targets. I have no idea why.
Copy link to clipboard
Copied
You can use the event emitter. https://helpx.adobe.com/captivate/using/common-js-interface.html to track slide enter / exit etc. I think you'd also need to use a dummy button inside captivate with the model.data to do the page jump. LMK if you need an example.