Making a button to start the animation:
- Draw the button graphics on the screen
- Convert the button to a Button symbol
- In the button Edit mode, make an Over, Down and Hit state
Insert Keyframes and modify the original button graphics or remove the previous graphics and draw new graphics to add Over, Down and Hit states.
- Up: what the button should look like when it is not clicked on
- Over: what the button should look like when someone rolls over it
- Down: when someone holds the mouse down on it
- Hit: This does NOT show up on the screen - it is defining the area that is clickable - draw a solid black shape to define the area.
To Assign an action to a button:
- Make sure you are at Scene 1 (not in the button editing mode)
- Select a button or movie clip INSTANCE and choose: Windows > Actions (F9)
- Make sure Script Assist is ON
- Under Actions 1.0 and 2.0, select Global Functions
- Double-click goto under the Timeline Control
- Notice it adds the Event that triggers the command (on release)
- Enter Type = Frame label and Frame = the name of the label in Parameter text box
- Select the on release and select an event type
** To make an INVISIBLE BUTTON create a button with EMPTY up, over, and down, but a graphic in the HIT area!
- Mouse Events: (from Actions > Movie Control > on)
- On (press) - when mouse is pressed
- on (release) - user pressed and released mouse button
- on (KeyPress "") - user presses space bar
- on (rollOver) - when cursor rolls over the button
- Release Outside - when mouse is released outside the button
- Roll Out - when cursor rolls outside of the button
- Drag Over - mouse button down over button and then dragged out then in again
- Drag Out - mouse button down over button and the pointer rolls outside the button
Pausing the timeline in Flash allows for events to occur to completion or allows time for user input before the Flash movie continues.
To pause the main timeline:
- Create a layer called: actions.
- On the actions layer, place a BLANK KEYFRAME in the frame where you want the movie to pause.
- Open the actions panel (Window menu > Actions) or click: in the property inspector.
- Turn off the Script Assist
- With the frame highlighted in the timeline, type: stop(); in the actions panel.
NOTE: a stop() on the timeline will pause the timeline and any GRAPHIC symbols at the frame where the stop() exists. Graphics will pause because their internal timelines are synced and dependent upon the main timeline.
Pausing MC (movie clip):
- MCs timelines are independent of the main timeline and therefore do not pause when a generic stop() is placed in a frame.
- Instead, each INSTANCE of a MC on stage needs to be given an INSTANCE NAME and then told via that name to stop.
- In the case above, the stop() refers to whatever is named before the period and can be placed on a frame in the timeline just like a regular stop(), but will only effect the named instance it corresponds to.