| Now that we are ready to add some buttons to our Kwik book app, we need to discuss a little about buttons, button layers and button states. In Kwik, any object can be turned into a button, such as a graphic or text layer, a full page or a Group.|
Also in Kwik we can use two types of buttons and the type we choose will determine the number of layers that we need for the button. Let's walk through an example. We have a rectangular shaped object on a layer on our page that we want to use as a button.
Rollover Buttons and Button States
The first type of button is the rollover button. In Kwik a rollover button has two states. The first state is called the Default button state. When the iPad does not recognize a touch gesture (your finger is not touching the button on the screen), it is said to be in the Default state. The second state is called the Over state. When you are touching the button, it is said to be in the Over button state. These rollover buttons change their appearance when they change from one state to another.
For example, a rollover button could be a white rectangle when the button is not touched and have a green glow around the rectangle when the button is touched. What is really happening here is that the plain white and glowing white graphics are being switched as the button changes states.
Therefore to create this rollover button, we need one plain white rectangle and one glowing white rectangle. Each rectangle will be on its own layer named "Defaultbtn" and "Overbtn". When we create this button, we will need to tell Kwik to use the object on the Defaultbtn layer as the Default state and the object on the Overbtn layer as the Over state.
As you would expect, a non-rollover button only has one appearance for both the Default and Over states. If we wanted to use only the plain white rectangle as our non-rollover button, we would tell Kwik to use the same Defaultbtn layer for both the Default and Over states. Kwik will do the rest of the programming for us.
When Buttons Are Shared Assets
In our example book app, we have three buttons that will appear on all pages. These are the Pages (Index), Next and Back buttons. The best process to follow is to set these layers as shared assets before we turn them into buttons.
We will create these shared Pages, Next and Back buttons as we build page 1 of the book, which we will then use as a template. By doing this and using the template to start each page, the buttons will work consistently throughout the book.
Join us in the Flash forum. | Join us in the Digital Art and Design forum.