Creating and setting of variable objects is described in article Variable objects. Variable object can be controlled by individual buttons (for creating buttons, see article On tap action.
Variable buttons
You can create a button that changes its appearance in a situation where the variable object is in a given state. Suppose you have created a variable object with five photos. Under the object now draw a button with text 1. As the On tap action command set a variable object switch to State 1.
Now from this button create also a variable object and create State 2. In this state, set a different color to this button. Note that the On tap action command was transferred from the button itself to the variable object. Now duplicate this variable object, move it, and in both States change the text to 2. Also change the On tap action to switch to State 2. Similarly, create buttons 3 and 4.
Now open the preview: Button 1 is automatically displayed with cahnged color. If you click on any other button, variable object will be switched to the appropriate state and will also “light up” the appropriate button. Bttons will also light up/down if you manage to control the variable object with other buttons. Move to next/previous state, or drag your finger directly across the variable object (if such a control is enabled for variable object).
State 0
Frequently is also demanded a variable object, which contains eg. some detailed information while various buttons open these states. However, it is suitable to have a state where there is no detailed information listed. This can be automatically the State 0. Therefore simply open a variable object settings and enable the Use State 0 option. In the list of states the State 0 is then found on the first position – can not be duplicated, deleted, or moved elsewhere. This is the default State of variable object when nothing is displayed.
When creating buttons for variable object of State 0 you may also use the Go to State 0 option. (By meaning it corresponds to situation “hide the current state of the variable object”.
Animations, videos and audios within the state of variable objects
If the condition of variable object contains the object that will be animated after the “Startup”, or video/audio with automatic start, then this occurs at the point when reader goes to the given state. Example:
Draw a picture and a text label. To a text label, set the animation when alternate state will have a zero saturation – from this condition is switched after 3 seconds. Set also the item “Switch on hide”. Group objects, from this group create a variable object and gradually duplicate states and replace image sources and text labels. Set that the variable object will be switched by dragging left/right and test it: when you drag your finger the picture switches on and after 3 seconds the label appears.
Now go to any of these states, open a group and draw new object of Audio type. Set for automatic start. Test it: you will hear the sound when you go to given state. Audio Playback ends when you leave the state. Use either the sound effects at the switching of states, or even recorded commentary to a photo.