- If you wanna create buttons to control a video you can do so, but each action such as play or stop has to be done as a single button. In other words, there's no way to toggle a button's property from play to stop and then back again. But, we can take advantage of MSOs to make it appear to the user that they are tapping or clicking on a single button that will change. Let's take a look at how to achieve that effect. Okay, I've got a file open here and I've got a video placed and I've got the two buttons that I wanna use here or I got the artwork for the two buttons that I wanna use here and I'm gonna select both of them.
I'll use the align tools to get them lined up. Let's just align left and align top just to make sure that they're lined up nicely. And then I'm just going to drag this over a little bit until it's centered because I wanna make that look just right and that's centered now. Now I've got both of those groups selected and I'll show you that in the Layers panel here. I've got the two groups selected that are going to become the artwork four buttons so let's just close up the Layers panel here and open up our Object States panel.
I'm just gonna drag it out here so that I can work with it and let me just line this up just a little bit, so it looks a little bit better. I'm going to click on the Convert selection to multi-state object and now I've got my two states, and when I click on State 2, I get my stop action. I click on State 1, I've got my play action, and we can even rename these, so let's call this play, and then we'll come down to State 2.
Click, click again, and we'll call this stop. Okay, and we can even name the object to Button for video. Okay, that's done. Now, I want to put buttons into each of these states that will control the video and stop it and play it. So that may seem like a simple task, but the problem is once you put a button into a multi-state object it can't control something that's outside of that multi-state object.
Let me show you what I mean. I'll take out my Buttons and Forms panel, and let me just bring this out here for right now. I'm going to just draw a button real quickly so you can see what I'm talking about. And I'm just gonna put it right here on top of the MSO that we're working with. And I'm gonna add an action to it with video, and since there's only one video on the page, that's going to be selected by default, and I'll just leave the play action even though the MSO is showing the stop.
It doesn't really matter for the purposes of this demonstration. So I've got it set to play. Now I'm going to select the MSO as well, so let me get that. I've got the button, I've got the MSO, and I'm gonna add that to the visible state, and let's see what happens when we do that. The button is in there, but let's see what happens when we dive in and double-click on the button. We've lost the action. Let's just undo all of this.
I'll just hit command+z to get out of that until we've got no button here. Now I wanna do something a little bit differently, so let's for now go back to the play action by clicking on that state. I'm gonna draw a button again, so let's do that again and this time I'm just going to convert it to a button. I'm not gonna add the action yet. Now there's a little trick that I learned from my friend Keith Gilbert who is author a Lynda author, so check out his courses here as well.
What happens here is we're gonna draw out a small text frame here. Doesn't matter where you put it on the page. It doesn't matter even how big it is, just that it's a text frame, and I'm gonna come up and I'm gonna get my selection tool and I'm gonna select the button again. Now there's a little icon here in the upper right corner and if I zoom in on this section of the page here, so it becomes a little bit more apparent. Let's just drag this off to the side so that we can see everything we're working with.
I've got my button selected and over here where I'm pointing with my cursor is that small text frame, so let's just click here, and drag over to the text frame and now I've anchored this button to this text frame. Now let's see what happens if we select the text frame and the multi-state object. Let's now use the Add objects to visible state and see what happens to that button. Alright, let's come on over now that it's in there and let's click on that button.
And let's add the video and sure enough, I can now control that video outside of the MSO. So that's great. We need to do this one more time for the stop action. Let's just select the MSO and you may notice that that MSO is now a little bit bigger. That's because that text frame is in there as well. Don't worry about that. It's just fine. It's not gonna hurt anything. And let's go to the stop action and let's do the same thing.
I'm going to draw out an empty frame for our button. Let's just make it about the size of the button here, and let's convert this to a button with the Convert to button action. Again, I'm not gonna add anything to that here because I'll lose that when I put it into the MSO, so let's just draw out our small text frame here to anchor it. I'll come back up and get my selection tool. Get the button. Let's find that little icon and drag it over into this text frame.
Select the text frame, shift+click to select the MSO as well. Let's add that to the visible state. Now let's click on the button to get that selected. We can add the action for the video to stop the video this time. Now, we need to do one more thing. That's great, but how are we gonna get this button to change? Okay, there's one more thing we need to do. We need to add another action to each one of these buttons to get the states to change.
So I'm in the stop state and I wanna add an action to go to the next state in this MSO. I could use the Go to state action as well, but since it's only two states using Go to Next State is gonna work just fine so let's use that. So I have Stop the video and Go to the Next State. Okay, that's gonna work just fine for this state. Let's go back to the MSO.
I'm just gonna come back over to the Layers panel because once we get to this point it gets a little difficult to select the MSO. Let's just come on over here in the Layers panel and do that. That's just great, so let's come on back up to the play state by clicking on it in the Object States panel and now we've got our play button here as well. I can just double-click to get that. I've already got the play action selected here as you can see, and I want to add that Go to Next State action here as well.
And that's gonna take me to the stop state in this MSO. Let's take a look at how well that's going to work out for us. I'm gonna do this with DPS to test this out first, so let's just go over to the Folio Overlays panel and click on the Preview, Preview on Desktop. Well I've got my play button and I've got my video. Let's see what happens when we click on this.
Well it played the video, but it didn't go to the next state. Let's just close this up and see what happened here. So let's just close up the Folio Overlays panel. Let's get this button and let's try something else. Instead of Go to Next State being here along with the video, what if we try having the Go to Next State first. Let's drag this up in the order and see if it goes to the next state and then plays the video.
It's worth a try, right? Let's go to Folio Overlays panel and click on the Preview. Preview on Desktop. Let's try this again and see what happens. That's much better. Now apparently, and I'm not really sure why for some reason, this will only work if you have the Go to Next State action first. So let's just come back here and finish this up.
I'll close the Folio Overlays panel. Select the MSO. I'll go to the stop state and I'm gonna do the same thing with this button. I'm just going to drag the video down to be the second action in here and we can try this and make sure everything's working exactly the way we want from the Folio Overlays panel. We'll just go back to that Preview on Desktop again, and open the Adobe Content Viewer. Let's just make sure everything is working the way we want it to.
I'll click on the play button and it goes to the stop action. You can probably see those cars driving over the bridge, and let's click the stop down and see what happens. Yep, sure enough, it stops. It goes back to the play action and that is exactly what I want. Now this technique works great. It adds a little bit more flexibility for you in controlling and playing back videos. Now the one thing I do wanna point out is that I have been using the Adobe Content Viewer to show you this.
It should work in Fixed-Layout EPUB as well; however, as I record this course, there is a bug in the Fixed-Layout EPUB Output that does prevent the playback with anchored buttons. So keep an eye on things and hopefully Adobe will get that bug straightened out soon.
- Working with the Object States panel
- Creating content for basic multistate objects (MSOs)
- Using layers and pages to create MSOs
- Adding and removing states
- Adding content
- Adding objects as states
- Controlling MSOs with buttons
- Using MSOs for interactive content
- Nesting MSOs