One of the well visited articles on this blog is Toggle button in which I explained how to create a custom button to change the state of the playbar, CC, audio from On to Off and vice versa. I explained there as well how to use the same Expression with a boolean user variable instead of one of the available boolean system variables.
In versions before Captivate 6 it was necessary to have such a button on each slide, cumbersome, even if they had always the same advanced actions attached to them so that Copy/Paste would do the trick. But now we have .... shape buttons that can be used both on Master slides or timed for the rest of the project as I explained in 'Why I like Shape buttons'. This article had some simple use cases and I promised to show the scenario for a real toggle button. This is the subject of the present post, explaining how to create a toggle button to turn off/on Audio. There will be a companion video on YouTube showing the work flow. I'll offer you different scenarios, starting with a very simple one, and ending with a button that really shows the state of the Audio.
Scenario 1: Shape Button with simple action
In the Shape category Buttons, you'll find a Mute button. It is already configured as a button, but without pausing and has a simple action attached to it:
Assign cpCmndMute with 1
You can put this button on the main master slide, so that it shows up on each slide of your project, or you can put it on the first slide of the project and time it for the rest of the project.
If course this is not a toggle at all, it only allows to mute audio. And the user will hear, but not see the 'status' of the audio. Personally I think the icon on the button is misleading, because it seems more to point to 'play audio' instead of 'mute audio'.
The easiest way to change this shape button into a real toggle that can mute/unmute the audio is to change the Assign action into:
Assign cpCmndMute with 1 - cpCmndMute
This works fine, but from my recent article Why Choose Standard over Simple Action you know that if the shape button is paused, clicking on it to mute/unmute audio will also release the play button. And of course, the button will always look the same, will not show its status.
Scenario 2: Shape Button with standard action
You get it: change the simple action to a standard action, and the play head will not be released. To have it on each slide, you can again choose either to put it on master slides or to time it for the rest of the project on the first slide.
But still you are always looking at the same icon on the button, no difference between mute/unmute. Up to the third scenario:
Scenario 3: Shape Button with conditional action
You need two items to show the change of state. In my example I used a line shape, not functional as button, that would cover the original audio button in unmuted state:
The idea is to show/hide the line shape depending on the current state of the audio. The conditional action has to be able to address the ID of that line shape. Since objects on master slide do not have an ID, they cannot be addressed by an advanced action. That leaves me with two possibilities:
- Putting the audio button shape (from the Smart shape category Buttons) on the main master slide, and the line shape on the first slide, timed for the rest of the project.
- Putting both the the button and the line shape on the first slide, timed for the rest of the project. Both get an ID in that case, and I'm even able to group them.
Because of the low priority of objects timed for the rest of the project (as I explained in the blog post about Shape buttons), it is necessary to check 'Place Object on Top' for shapes that are timed tha way. It is up to you if you want pausing, hand cursor... Here is a screenshot of Timing and Options for the button shape. For the Line shape I only have the option 'Place Object on Top' checked and on the Timeline the line is above the button, not to be covered up by the fill of the button of course.
This action has 2 decisions:
- Always is a mimicked standard action, that toggles the value of cpCmndMute the same way as in the standard action of Scenario 2
- CheckAudio checks the value of cpCmndMute, if it is 1 it will show the shape line, if not it will hide it.
Scenario 4: switch Shape buttons !!!
Yes, indeed, this was a very exciting discovery: you cannot have two regular button in the same location on a slide, even when you hide/show them alternatively. I explained this in the first article about Toggle button. But Shape buttons are different: you can have two of them in exactly the same place and this will now allow you to do the real stuff: a totally different shape to Mute and to Unmute audio. I really hope that all the users I had to tell that this was not possible before, will read this article.
Watch this one slide movie, click the Stop button (shape filled with an image), it will switch to the Play button.
Both shape buttons trigger a standard advanced action, StopAudio, PlayAudio. SInce the audio plays on the slide when the movie starts, the Play button is initially set to invisible. And since both are shape buttons, you can put them on the first slide and time for the rest of the project to have the toggle available on all your slides. Like with scenario 3 putting on the master slide is not an option because the shapes need an ID to be used in the actions.
What I explained for an Audio toggle can of course be applied to all your toggle buttons: turning on/off CC, Playbar, opening/closing a TOC in overlay (with the new cpCmndTOCVisible variable), Play/Pause (video tutorial will be posted on YouTube), etc.