Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
So we're creating this interactive widget, a game that people can play that would belong on a web site. We've brought in artwork from Illustrator, and we've started defining components or buttons to allow people to interact with this. However, what happens when they are going to click on a button? We need to let people know whether or not their guess is right, and whether or not they've won the game. To do that, we're going to create additional pages for our project. The concept here is that once I click on a button, that action will trigger a move to a different page.
So let's take a look over here at the Pages and States panel. In my project, I currently have one page and it's called Page1. Well, that won't do for me. I need to actually name my pages. In fact, we've already seen how important it is for you to name your layers, because of how easy it is to select artwork through the Layers panel. You also want to take the time to actually name your pages. As we're going to see, when you name your pages, it will become that much easier for you to work with your project later on. To name the page, I am simply going to come here and double-click on where it says Page1, and I'll change the name of this to PlayGame.
It's important to know that you can't have spaces inside of a name of a page, so I'll often use capital letters to identify a different word. I'll press Enter to accept that, and now I have successfully changed the name of this page. Now, there are two ways to add a new page to your project. I can either duplicate it or I can create a new blank one. For this widget, I want many of the elements to stay the same on this other page, so I am going to choose to duplicate the state. I am going to change the name of this page to Winner, and click Return or Enter to accept that.
Now the two pages that I have created are identical. So let's move over to the Layers panel and switch a few things up. To make it easy to see what's happening here, I am going to double-click on the Timelines panel to hide that. I don't need to see the elements inside of the Bottles layer here, so I am going to close that. But I do want to focus on what's inside of the Results layer. I'll click over here to reveal the elements inside of the Results folder, and you'll see that I have a Rectangle here. I created that layer inside of Illustrator. It's simply a black rectangle that has an Opacity value applied to it. I also have some elements that will appear on this page, and I'll choose to reveal all the elements inside of the Winner layer as well.
So now let's review what we just did. I'll click on the PlayGame page to see the first page of my widget, and if a person chooses the right flavor, they will see the Winner page. What happens when they choose the wrong flavor? Well, let's create a new page for that as well. With the Winner page currently selected, I am now going to choose to duplicate it. I am going to rename it to be Loser. I know no one ever wants to be a loser, but in this case here we have to have a page with that name. And in the Layers panel here, I'll hide the Winner layer and show the Loser layer.
I now have three distinctive pages inside of my project: PlayGame, Winner and Loser. Now, focusing primarily on the Winner and Loser pages, there are certain elements that appear here that users will be able to interact with. For example, if you win, you can type in your e-mail address and submit it, or you can click on a button to learn more about the olive factory. And on the Loser page, you can choose to learn more about the olive factory or you can try your luck and play the game again. Just as we did with the bottles, we can easily convert these to functional components.
Let's start on the Winner page. I'll come to the Layers panel to reveal the elements inside of the Winner layer and scroll-down here to reveal its contents. I have an object here called Text_Field. With that selected, I can now see that the HUD will allow me to convert that artwork to a component. In this case, I don't want a button. I want people to actually fill in that text field, so from the list of components, I'm going to choose Text Input. Next, if I select this group, I'll see that these two buttons have been grouped together. I need to create them as separate buttons.
So I'll twirl down the group to reveal its contents, and I'll start by clicking on where it says Submit, and then I'll hold down the Shift key, and click on the button here to select those two elements. I'll convert that to a button and then I'll scroll down and choose both the Learn More, and again holding down the Shift key, click on the Button here and convert that to a component. So I now have two buttons and a text field. Let's do the same thing for the Loser page. Let me close up the Winner layer here, reveal the Loser layer.
I don't have a text field here, just two buttons, so I'll open up this Group, I'll click on Play Again, hold down the Shift key and click on Button, convert that to a button. And I'll click on Learn More, hold down the Shift key to select this button right here and convert that to a button component as well. So now I have three complete pages of my project: The PlayGame page, the Winner page and the Loser page. Each of these pages have several components inside of them. Let's save our work. I'll go to the File menu, and I'll choose Save As.
I'll save this as olive_game3 and click Save, and let's actually run our project to see how this looks inside of the Web browser. I'll go to the File menu and I'll choose Run Project and I'll see a preview of this in my Web browser. And you can see now that I can mouse over each of these bottles, but when I click on them, nothing happens. In fact, I can't even see those two other pages that I've created: the Winner and the Loser pages. The reason why is because I haven't defined anything inside of my project that tells these buttons what to do when I click on them.
All I've done is changed their appearance when I mouse over them. However, to make the buttons actually switch from one page to another, I need to define something called an Interaction, and we'll cover that in the next movie.
Get unlimited access to all courses for just $25/month.Become a member
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.