How to Make Buttons Clickable in AS2
Creating clickable buttons in Adobe's Creative Suite is an essential skill to hone if you plan on extensively using the program for multiple projects or for an extended period of time. Creating buttons is one of the most common tasks you will be completing while designing a web page. While creating a Flash button may sound difficult, it is actually quite simple if you follow the proper instructions
Instructions
-
-
1
Select the "File" tab option marked "New" and choose "Flash file." Drag the button component from the "Components" panel to your current documents library. Add the following ActionScript to the "Actions" panel to create a button:
"this.createClassObject(mx.controls.Button, "my_button", 10, {label:"Click me"}); my_button.move(20, 20);."
Once the script has been entered, a button will appear on the screen.
-
2
Continue by adding the following ActionScript to create an event listener for your button:
"function clicked() { trace("You clicked the button!");} my_button.addEventListener("click", clicked);."
This will give your button a customized function and will tell it to launch when the page is opened. It will also tell the user that the button has been successfully clicked.
-
-
3
Select "Control" from the menu and select the "Test Movie" option. On the screen, you will see that when a user clicks the button on the web page, she will also receive a message stating "You clicked the button!" The text used can be edited to your liking by changing the text component in the ActionScript, but you should convey the message that the request to click the button has been successful.
-
1