How to Make Toggle Button Using True/False Variable with ActivePresenter 9
True/False variables in ActivePresenter 9 can return either true or false values. They can be used to track things that are right or wrong, on or off, clicked or not clicked, or even control two states of an object, for example, a toggle button.
The True/False variable is one of the three variable types that ActivePresenter 9 provides. In this tutorial, you will learn how to use it as a condition to control the two states of a toggle button like this:
This tutorial covers:
- Design the Two States of the Toggle Button
- Create a True/False Variable
- Assign Actions to Adjust the Variable
Design the Two States of the Toggle Button
A toggle button consists of two states, on and off. You prepare an image as the ‘on’ state then access the View tab > Object States to add the other ‘off’ state to it.
To learn more about the Object States in ActivePresenter 9, refer to this tutorial.
Create a True/False Variable
If you click on the toggle button, the two states will show up in turn. For that to happen, you need to use a true/false variable and change its value to true or false for each state whenever the toggle button is clicked.
To create a true/false variable, you navigate to the Home tab, then click on Variables.
In the dialog that appears, click on the green plus button at the bottom to add a new variable, select the TRUE/FALSE type, and define its initial value if any. Then, click Add & Close to finish.
Assign Actions to Adjust the Variable
Now add actions to switch between the two states of the toggle button.
Firstly, you select the button and navigate to its Properties pane > Interactivity > Events – Actions. Then add the On Click event and the Adjust Variable action. To enable the toggle function, you select the true/false variable created earlier from the list and the Toggle operator.
After that, you add the Change Object State actions and conditions corresponding to each state as follows:
Since the initial value of the variable is True, so you should assign it to the default ‘on’ state. And assign the ‘false’ value to the other state.
For more information about events and actions, see Use Events-Actions to Add Interactivity to Courses.
That’s it! You have learned about how to use the True/False variable to make a toggle button. Hopefully, this tutorial will be helpful for you. Please feel free to download ActivePresenter 9 and try it out!