A custom generic menu/click-and-reveal (v. 2019)
A someone that enjoys the freedom of Captivate 2019 I have not yet made the transition to the new Captivate. For those others of you that still linger, I have two small lines of javascript that you might enjoy.
They allow you to have one actionscript that can control the action of many buttons. This can be useful for click-and reveal-exercises or if you have a menu in the middle of your course, where the buttons will take you to different slides.
Start by creating two variables in Captivate. These will store the ID of the active button/the button you click, and the first number in the ID between 0 and 9 (including 0 and 9. I call these clickedBtnID and clickedBtnNumber.
Create an actionscript and in the first tab/decision execute this javascript:
clickedBtnID = this.document.activeElement.getAttribute("ID");
clickedBtnNumber = Number(clickedBtnID.match(/[0-9]+/));
All it does, is to store the ID of the button you clicked in clickedBtnID and to find the first number in the ID. So simply name your buttons using a number in the name. Something like menuBtn1_, menuBtn2_, etc. The underscore is nice to have if you plan to copy and re-use the slide, as the name/ID needs to be unique, and Captivate automatically ads an incremental number at the end of the name/ID (menuBtn1_324 etc.).
Now, the second tab/decision will be conditional and check if the variable clickedBtnNumber is equal to 1. If it is, the button clicked was the first one, and you can do whatever you want … jump to a slide, change the state of something, show/hide whatever. The next tab/decision will check if the variable is equal to 2, and so on.
Using cptExtra from Infosemantics @ and # syntax, you can make slides that you can copy/paste and re-use without having to use shared actions or to re-name any objects.
I hope you all find this useful.
