CREATING A BUTTON
Lets start with a blank document. Draw a box on the canvas. Adjust the colors as you wish with the COLOR MIXER and such. Now, select the text tool and draw text over the box. Name it something like, "CLICK ME"
TIP: If you ever create something and then you cant see it, make sure its arranged to the front, by clicking on MODIFY --> ARRANGE -->BRING TO FRONT. Also, when working with layers; if a layer is on top of another, whatever is in that layer- will be on top of anything in any layer underneath.
Now, I want you to highlight everything, (can press CTRL A) and RIGHT CLICK --> CONVERT TO SYMBOL. Now, select "Button", and name it whatever you wish, ( b_myButton ). Now when you select it, its no longer two different. objects- its one. Now, select it and RIGHT CLICK --> EDIT.
At the top you'll see, "UP" "OVER" "DOWN" "HIT". These are layers for the button. When active, the button will display the "OVER" Layer when the mouse is over it, "DOWN" when you click down, ect. Insert keyframes in each layer. ( right-click in each --> select insert keyframe ). Now select the "OVER" layer. Lets make it a lighter color than it is. Same with the text. Now, select the "DOWN" layer. Lets make the text say, red. and the "HIT" layer is different. This lets the mouse know where to begin activation of the button. Select the "HIT" layer and draw a box bigger than the button. Now, when active; the mouse icon will change as if you were over the button once it is over whatever the boundaries are of the box you drew in "HIT." It can be larger or smaller. Understand? Work around with it, you'll get the hang of it all.
Go back to the canvas, ( click on SCENE 1, or EDIT --> DOCUMENT ). Go to CONTROL --> TEST MOVIE. Click on your button and see how it acts. Cool eh?
Now you have your button, but dont you want it to go somewhere when you click it? Of couse. But this will involve some action script. I'll show you a basic action here. Right click on your button and go to --> ACTIONS. This will bring up the actions option. Make sure you're in normal mode by clicking on the far right button with alt "VIEW OPTIONS" --> select NORMAL. Ok, and on the left are the actions. movie control area of the actions should be open. If not, click on movie control where it shows the actions under it. Select the goto option, and drag it into the white empty area. New options will show up. Make it:
this is self explanitory- on release, it will goto and play frame 5. The other shit, it puts in there for you so it will work. Learn more in the ActionScript tutorial. Do we have anything in frame 5? No. Ok, lets put something there so we know its working. Click on the button layer and select frame 5 and insert a blank keyframe (do the same for actions layer) [we want it blank so you dont see the button in later frames]. Create another layer real quick and add a keyframe in frame 5 and add text that says, "YOU'RE IN FRAME 5 NOW." THEN - create a button that says "back" Now, you may or may not have noticed that flash will automatically loop your movie. This means that it will play it over and over and over and over and over and over...STOP! right? So lets tell it to stop on frame 1. Select frame 1 in the actions layer. RIGHT CLICK -->ACTIONS. and the stop function is on the left like this:
drag it into the white area for code to go, and now- the movie will not go any further until you tell it to. Add another stop(); to frame 5 in the layer of, "YOU'RE IN FRAME 5 NOW." You may have the hang of it by now... but right click on the "Back" button you created. and go to --> ACTIONS. Select the goto from the left. Make it:
This will take you back to frame 1 and start all over again. CONTROL --> TEST MOVIE to see if it all works. You shoul see your button, "CLICK" -->When you click it, it says; "YOU'RE IN FRAME 5 NOW." and a "BACK" button underneath that. And when you click the back button, it takes you where you started.
No Comments for this page.