Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
We're creating a really cool widget. It's an interactive game that we can put on our web site. So far, we've taken artwork from Illustrator, brought it into Flash Catalyst, created components, and we've created separate pages. The pages tell you whether you have lost, won or are about to start playing the game. However, there's no logic yet. We haven't really specified what happens when you click on a button, and how you get to win or lose the game. Specifically, we want to make it so that when somebody interacts with this widget, when they click on one of the flavored bottles, that action will trigger a move to a different page.
In Flash Catalyst, we refer to this as an Interaction. An Interaction makes something happen inside of your project. If you've taken the time to really think about your project in advance, and if you've named all of your pages, this is probably going to be one of the easiest parts of creating this project. In Flash Catalyst, we define all of our interactions through the Interactions panel which is right here. First, let's decide which of these flavors are going to result in a winner. I'm thinking about rosemary. So I'm actually going to go ahead now and click on that bottle to select it first.
And then I'll come here to the Interactions panel and I click on this button here called Add Interaction. This brings up now a dialog box, where I can specify exactly what happens when somebody interacts with that button. The first pop-up over here allows me to identify what action on the user's part triggers this Interaction. I can choose On Click, On Mouse Down, On Mouse Up, On Roll Out or On Roll Over. In this case here, I'll choose On Click. That way when somebody clicks on the button, I want something to happen.
What do I want to happen? Well, I can choose to Play Transition to another state. Since we want rosemary to be the winning choice, I will choose from the Choose State pop-up, the Winner state. This is where it becomes obvious that naming your pages is really important. If I had kept things as Page1, Page2 or Page3, this can be a little bit confusing. But I'll choose Winner, and I can also choose exactly when that happens. For example, do I want that button to be active at any state? Well, probably not.
So in this case here, I want it to only happen when I am in the PlayGame state. Now I'll click OK to add that Interaction. Now, let's add interactions for the other two buttons. It might be easier to select these elements from the Layers panel, so I'll close the Results layer, open up the Bottles layer, and I'll click on the next Button over here which is the Mandarin Orange flavor. In the Interactions panel, I'll click to Add an Interaction, On Click, I want to Play Transition to a State. Which state? Well, in this case here they are going to be a Loser.
And again, I'll specify this happens only in the PlayGame state and I'll click OK. Finally, I'll choose to the Jalapeno flavor and I'll do the same. Add Interaction, choose State to the Loser state, when in the state of PlayGame and click OK. One of the things that I really like about Flash Catalyst is this pure and simple menu-based control. Let's specify Interactions for the other buttons in our project. Let's switch to the Winner page. We want to make it so that when they click on the Learn More button, it takes them to the web site.
To select that button, I'll come over here to the Results layer, reveal the contents of the Winner layer, and click on the Button down over here to select it. Next, I'll Add an Interaction, but this time, On Click, I don't want to play a transition to a state; instead, I want to Go To URL. When I choose this option, I have a field here where I can actually specify a different URL. I'll type in, let's say http ://, Let's put in right now, http://www.lynda.com just for now.
And I can also choose to open that in a new window. I'll click OK to accept that. And let's talk for a moment about the Submit button. Normally, I'd need to have a script to actually create some kind of Submit function online, and as a designer, I don't know how to do that. However, the component itself is a regular button. So what I could do is I could hand this file off to a developer, and they could write the necessary script for me. It's just another way that designers and developers can work easily with each other when using Flash Catalyst.
Let's take a look at the elements that are on the Loser page. I'll use the Layers panel here to select those elements. Let me go over here to the Loser folder, click on this Button right here for Learn More, Add an Interaction which will On Click Go To a URL and I'll specify a web site again. I can choose to open it in A new window, and I'll click OK. Now for the Play Again button, I simply want them to return back to page one. So I'll select that button, and I'll add an interaction that on click, I want to play a transition to state. Which state? Back to the PlayGame state.
Next, I'll click OK and let's go back to the PlayGame state as I see it right here. Before we test this, let's go ahead and save our file. I am going to choose File > Save As. I'll save this one as olive_game4, and I'll click Save, and then I'll go ahead and choose File > Run Project to test this in our Web browser. Notice now that when I mouse over these buttons, they light up as we specified, but when I click on them, they are actually functional. If I click on Jalapeno, I'll see that I have lost the game.
Let me try to play again. I click on the Play Again button. I come back to the original state. I'll try the Mandarin Orange flavor. No, that's not the right one either. I can choose Play Again, and if I can click on the Rosemary flavor, that's the right answer. I can click on this field here and actually type in my e-mail address, and while the Submit button is not functional yet, I can click on the Learn More button to actually open up lynda.com. Let me close this browser window though and go back to this project one more time. In fact, I'll choose to Reload it here inside of my window because I want to focus on one other aspect or element of this project.
You see that when I click on any of these buttons, the transition goes directly from one page to another. From a design perspective, I'd really like to have some kind of expressive motion happen between these two states of my design. To do that, I'll need to create something called a transition, and we'll cover that in our 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.
Your file was successfully uploaded.