In this tutorial, I will show you how to create a simple button in Flash CS4 and by using Actionscript 3.0, we will write a simple function for the button..
Ok. Let's begin.
1. Create new Flash File(Actionscript 3.0)

2. Select Layer 1 and choose Rectangle Tool button in Tools section to create new rectangle shape.


3. Set the Rectangle Tool Properties and draw the rectangle shape on the stage.


4. Select the rectangle shape and go to Modify>Convert To Symbol...(F8) at the top menu.


5. Give a name to that symbol and choose Type Button. After that, click OK.

6. Select the Button and go to Properties. Give a name to that Button as in the picture below.

7. Right Click on the Button and choose Edit in Place.

8. In the Button, you will see 4 conditions : Up, Over, Down and Hit.
Up - The default state.
Over - It's the state where you put your cursor over the Button.
Down - You click the Button.
Hit - Area that you want the button to become active and clickable.
I'll explain more about Hit in the next tutorial.

9. Right click in Over frame and choose Insert Keyframe. Change the color of the shape in the Over keyframe.


10. Repeat Step 9 for Down frame.

11. Go back to the main stage by clicking on Scene 1 link.

12. In the Timeline section, click on New Layer button to create Layer 2.


13. Right click inside Layer 2 frame and choose Actions.

14. Write a simple function for the Button like in the picture below.
simple_btn.addEventListener(MouseEvent.CLICK, goURL);
function goURL(evt:MouseEvent):void{
var urlReq:URLRequest = new URLRequest("http://jomreka.blogspot.com");
navigateToURL(urlReq,"_blank");
}

Click picture to enlarge.
15. Go to Control>Test Movie to see the preview of Button that we already created.

Click here to get the project file.
That's all. Cheers!! :)
Perkongsian yg bagus bro..teruskann
ReplyDeleteTq bro~ :)
ReplyDelete