Copy link to clipboard
Copied
I'm working on a project and I want to create a "menu" in adobe animate CC with some animations and three buttons (one for each chapter).
As of now everything is working but I want to tweak it a little because every time I'm adding a slide or removing one in captivate (client wants to make changes as we're working and I know I can wait until the slides are finished to change the numbers but I just want to know if its possible for future projects) I have to go back to Animate CC and change the slide numbers I want to jump to while clicking any of the chapter buttons.
My question is: is it possible to use a go to slide name instead of number?
right now I'm using this for my first chapter button in animate:
this.chapter1_btn.addEventListener("click", fl_MouseClickHandler.bind(this));
function fl_MouseClickHandler()
{
window.parent.cpAPIInterface.
gotoSlide(2)
}
if it's possible to go to a named slide instead of a slide number I could name the slides to chapter_1, chapter_2 and chapter_3, publish the oam file and import it in captivate and then ad or remove content slides within that chapter without going back and changing the slidenumbers i want to jump to in Animate CC.
*the "2" in the "gotoSlide(2)" is actually slide three in captivate, not sure why it is the slidenumber - 1.
/Johan
Copy link to clipboard
Copied
I always use advanced/shared actions, am not a JS expert. I always use the slide name with Jump To, so I think it should be possible with JS as well.
Your question about the variables. Some versions ago there were two system variable for slide numbers, one with index starting at 0 (rd variable) and the one that is now the only exposed one, starting with index = 1 (cpInfoCurrentSlide). I suspect JS is using the first variable, index starting with 0, like most system variables of that type.
Copy link to clipboard
Copied
I can't take credit for writing this piece of code (not that well versed yet), but this should do the trick -
function jumpSlideLabel(which){
var idx = 0;
var getSlides = window.parent.cp.model.data.project_main.slides.split(",");
for (var i=0; i<getSlides.length; i++) {
if (window.parent.cp.model.data[getSlides].lb===which) {
window.parent.window.cpCmndGotoSlide = i;
window.parent.window.cpCmndResume = 1;
break;
}
}
}
then call it -
jumpSlideLabel("SlideNameHere");