FLASH 8 and CS3. Action Scripting 2.0

Alejandra Jarabo
MAT 116

Media Arts & Technologies division. Santa Barbara City College
BUTTONS IN FLASH . ACTION SCRIPTING 2.0

ACTIONS ATTACHED TO A BUTTON 2

A Button is symbol that is specifically prepared to act as an EVENT HANDLER for an "action".

An Action is a piece of programming (a script) that allows to create a response to a deliberate movement of the end user.
The movement of the end-user that we track by default is the use of the mouse. When the user interacts with a button I can program something to happen at the time of certain part of the interaction:

I press a button: I go to a different frame and stop.
I rollover the button: I got to a different frame and keep playing from there on.

USING FRAMELABELS IN YOUR BUTTON-ACTIONS

In the next animation you are going to see an example of working with Frame labels.

You make a Frame label by "naming" a Keyframe on the Timeline.
To do so, select the keyframe, go to the Properties panel, and enter the name in the Text-field underneath the word "frame" that says "frame label in light gray.

A Frame label looks like a little red flag followed by a name (looking at the Timeline Window).

Navigating with Frame labels makes the Structure of your project Visually Clear, and allows you to do last minute timing arrangements (adding-subtracting frames, altering the order of events) without ruining all the previous Scripting.

If you want to navigate to a frame number 5 and later on change the timing, you might end going to a wrong place in the Timeline.
gotoAndStop(5);
When you script to go to a frame already labeled "part 1", it doesn't matter what number that frame ends being. ActionScripting looks for ANY frame number with that name in the Timeline.
gotoAndStop("part 1");

Frame labels should always be typed within quotes in the ActionScript window.
The frame-label code appears by default in green, when is done right.

 

In the future you are going to arrange your interactive projects so the Upper-most 2 layers are EXCLUSIVELY dedicated for Actions and for Labels.

(if the project is a simple one, you can keep actions and frame-labels in the ACTIONS layer)

This is a courtesy sign for other people reading your file, and it is a Standard work-procedure in the Commercial world.
It indicates that you are using Actions, and it is making them clearly visible for a programmer, designer (or teacher in this case) trying follow your steps.

   

How to make a Frame-label. How to attach an action to a button > go to a frame-label >gotoAndPlay

   
 
 
     
     

Notice that every time that

you press the button

you come back to the beginning

of the Motion Tween.