Adobe Animate. Action Scripting | Alejandra Jarabo |
Media Arts & Technologies. Santa Barbara City College |
PROGRAMING CONCEPTS |
ACTION SCRIPTING 3.0 (AS 3) HOW TO PROGRAM A BUTTON |
|||||||||||||||||||||||||||||||||
There are 3 things you need to take care of when you are ready to add code to a button:
Remember to follow my movie on how to name an instance of a button, HERE (link also provided in the Help page for module 9 in Canvas) |
|||||||||||||||||||||||||||||||||
1. Declare the function (the action that will happens when the user activates the button)
toAnser1 is the name I have invented for this function. gotoAndPlay is a METHOD (a ready-made function used to navigate the timeline) Main methods in AS 3.0: Some methods don't need any extra information to run: like play(), stop(), previousFrame() and nextFrame() See some different parameters the methods gotoAndStop and gotoAndPlay can use:
gotoAndPlay(20); Using a frame number. Follow my movie on how to use frame labels HERE (link also provided in the Help page for module 9 in Canvas) |
b | ||||||||||||||||||||||||||||||||
2. Name the button instance by selecting it on the Stage and naming it in the Properties panel, using the text field on the top.
|
|||||||||||||||||||||||||||||||||
3. Write down the event listener that will work with the button. This type of a structure, using the object name (working as a subject in the phrase), then the dot, then the description of what to do related to that subject is called DOT SYNTAX.
A Mouse Event occurs when the user moves the mouse in the user interface of ab application. The events defined for the MouseEvent class are: The extra sample file for the assignment (MouseEvents.fla) has examples of buttons activated with each one of those MouseEvents. Here you see the complete code to program an instance called play_btn
| |||||||||||||||||||||||||||||||||
To other AS 3.0 pages: On functions On variables
|