- In this movie, we're going to create an effect similar to the previous movie, that features a grid of images, and when you tap on an image, a text frame appears. But in this case, only a single text frame can be revealed at a time. This requires a completely different approach than when you want the user to be able to reveal multiple text frames at a time. In the Exercise Files folder, open 03_03_reveal_begin. If you look in the Layers panel, you'll see that there's a Text Boxes layer and an Images layer. Go ahead and reveal the Text Boxes layer, so we can see the six text boxes that are placed over each of the six images.
And we're going to begin by drawing an empty, clear frame over in the left margin area somewhere. The size isn't important, it just needs to be somewhere off to the side and invisible. And we're going to select that frame along with the six text frames, and we're going to turn this into a seven-state multi-state object, so we've got seven objects selected, so in the Object States panel, I'm going to click on the New button in the bottom-right corner, and it creates a seven-state multi-state object.
Go ahead and name this multi-state object text frame mso. And then we need to take a moment to name each of the states clearly. This is really important in this case. I'll pay off later when we really need it. And what you're going to do is name state 1, the one that has the clear frame on it, name that hidden. And then the other six states, you're going to want to name with a number corresponding to their position on the page. So this is number one, two, three, four, five, and six.
So these aren't necessarily in order, how they appear in the panel, and that's okay, but just make sure the right number goes with the right frame. So this is number three, this is number four, six, and so on. And then select the hidden state, so that we don't see any text frames on the page. And select the first image, and we need to turn this image into a button, so that when somebody taps this image, we want a text frame to appear, and we do that by assigning the Go To State action and choosing the correct state in the text frame MSO.
So I've got this frame selected, I'm going to go to the Buttons and Forms panel, go to the Actions dropdown, and choose Go To State, and I want to go to state 1 of the text frame MSO. And we select this frame here, choose the same action, Go To State, and we want that one to go to state 2. Repeat this process for the remaining four images. Once you've completed that, go ahead and preview your work. Use the EPUB Interactivity Preview panel to do this, and you should see that this works pretty good at this point with one minor exception.
Once I've got a frame displayed like this, it would be a nice touch if I could dismiss the frame to reveal the image underneath by clicking on the frame again. And that doesn't work. And the only way I can do that currently is to select a different frame, but I want to be able to click to dismiss this frame also. Let's fix this. Go ahead and close the preview. And in the Layers panel, hide the Images layer temporarily. Click on the empty frame to select the text frame MSO, and go to state 1 of the text frame MSO.
And we need to turn the frame on this state into a button, so double-click on the text frame to dive down into the state and select the frame within. And then we want to assign the action Go To State and tell it that when I click this, or tap this, I want to go to the hidden state, so make the frame disappear. Then hit the escape key a few times to climb back up to the parent MSO. Go to the second state, double-click on the frame to get the frame selected, and again, Go To State, and you want to go to the hidden state.
Hit the escape key a few times again to go back to the parent MSO. Go to state 3, and repeat the process. Now just one little side note here, you might wonder why I have to double-click to actually get the frame selected. That's because you cannot assign a button action to a state of an MSO. You have to select something on the state to turn into a button. So I'm selecting the frame within the state and giving that the Go To State action. After you've repeated that process for all six images, then preview your work again.
Whoops, except I've got a problem here. Good teachable moment. What did I forget to do? I forgot to turn my Images layer back on, so I'm going to reveal my images, and then preview it again. Now, when I click on the images, of course, the frames appear and disappear, but the improvement I've made is that I can click on this frame here, and it disappears entirely. This technique is really useful. Of course the objects don't need to be displayed in a grid format for this to work.
This would be equally useful for displaying pop-up labels of points of interest on a map, or anywhere that you need to have several pop-up boxes in close proximity.
- Creating animated navigation buttons
- Building interactive slideshows
- Creating reveal buttons
- Adding multiple choice and branching quizzes
- Creating a scrolling panorama
- Embedding video
- Creating buttons to send email