Toggle Shape buttons - Captivate 6

 DevLearn 2012: Info


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:

  1. 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.
  2. 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.

Conditional action

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.

17 responses
hi Lieve,

Thanks for this article. Very useful once again.
If I wanted to have the opposite happen here (Scenario 4: switch Shape buttons !!!) so mute button appear first and once the users clicks the play button appears and play the audio? Would I assign cpCmndMute with 0 instead of 1?


Yes, that is the way to go. There is a list with system variables available in another blog post, it explains the meaning and use cases for all variables. Try to download it.
Thanks Lieve,

Could you point me to that list please? Can't find it.

I can't work out how to mute the audio before it plays! I have the Shape Button assigned to cpCmndMute with 0 and that works to fine when the button is clicked because it plays each time its clicked. But I would like start by having it muted first.
In that case would I have to use a conditional action?
Something like:
cpCmndMute is equal to 0
Play audio anOnion.wav
Assign cpCmndMute with 1


Ben, the default setting for cpCmndMute is 0. So you have to initialize this variable to 1. It could be done on entering the first slide, with a simple action in the Action accordion of that slide, that variable is available in the dropdown list. However, depending on bandwidth, actions on the first slide are sometimes executed bit later. You have to check it out with the published version. In that case, insert a short blank slide, without audio, before that 'first' slide.
I cannot post functional links in the comments (need to move my blog to a proper site, but have so little time). Here is a direct link (you have to copy it to your browser) to the list:
And the blog post with the link:
Thanks Lieve,

You are kind.I got the System Variable list. Thanks.

Using: Assign cpCmndMute with 0 has worked because I thought having it play automatically for the user the first time is useful when the slides starts and now when you click on the button it plays too.

The issue I have now is that this sound also plays when I click on the "Next" button on this slide. I've set up this activity with a "Next" and "Back" button on a Master slide but when I click this button it triggers that sound files as it moves on! Any idea why?


Cannot see what is going wrong there. Could you go to the user forum, where you can eventually post a screenshot as well?
Lieve, Once again I learned something new from you. I never thought to do a 1 - cpCmndMute to toggle the value. Very clever and thank you for sharing your wisdom with the Captivate community!
Thanks Jim. I do love such expressions, they work fine. You can even type them in as a simple action when choosing Assign.
Lieve, you really provide very useful tutorials. I am wondering how you made this play button on top of the video. Is there a tutorial for that somewhere? Thank you!
@Chantal Sorry if this shows up as coming from 'A posthaven user'. I am Lieve, but for some reason I don't show up anymore as the author although I'm logged in. Have to cancel my Posthaven subscription (paid) and move the blog elsewhere once I find time to do it. That play button is just a default function of Captivate. I deactivated the AutoPlay in Preferences, Start and End, and added a poster image.
Hi Lieve, thank you very much for your quick answer. I hope you find a good alternative for your blog soon. It is very nice and helpful. I realise now that it is the Captivate Player itself you see (I was 'sleeping'), I thought for a moment that it was an in-slide video/flv player with a play button on top. I was searching for such a feature. Have a good day!
Hi, I have two shapes on top of each other. One with 'play' image, one with 'pause' image. Both are used as buttons and shown for the rest of the project. It works fine, until I change the setting of both shapes to 'Place object on top'. Then the functionality only works on the first slide that they are on. On the other slides the advanced actions of these shapes are no longer executed. Any idea why this is happening and how to solve this?
Did you check that they are not visible at the same time in the same location?
Hi Lieve, yes I did. It works perfectly on the first slide, but as soon as I go to the second slide, it doesn't work anymore. I have created a very simple dummy file to test it, so there are no special things in it.
Bit difficult to solve such problem on a blog site. Can you go to the Captivate forum, where you can post screenshots if necessary:
Thank you for sharing Lieve your love for advance actions shows and your posts are so helpful with the screen shots and step by step instructions.
1 visitor upvoted this post.