Presentation is loading. Please wait.

Presentation is loading. Please wait.

ActionScript Basics 2016 (2.0 – 3.0)

Similar presentations


Presentation on theme: "ActionScript Basics 2016 (2.0 – 3.0)"— Presentation transcript:

1 ActionScript Basics 2016 (2.0 – 3.0)
An Introduction

2 NOTE: Key information is in red.
Agenda What is ActionScript? ActionScript Statements Mouse / Keyboard Events Frame Events ActionScript Syntax Actions NOTE: Key information is in red.

3 ActionScript Basics What is ActionScript?
ActionScript is the scripting language for Flash Action Scripting is based on statements A statement is an instruction given to an .fla file to do something Convention for writing: One statement per line

4 ActionScript Statements
Statements are composed of events and event handlers Action script code is executed when an event (an action by the user) occurs Event Types Mouse events Keyboard events Event Handler (Action): what happens after an event is triggered

5 Mouse / Keyboard Events
Mouse / keyboard events occur when the user uses the mouse or the keyboard Rollover event: when the mouse rolls over a button On Release event: when the mouse is clicked and released On Keypress event: when a key is pressed and released on the keyboard

6 Frame Events Frame events are actions that take place when the playhead reaches a certain frame on the timeline A frame script is a script attached to a frame. The most commonly used frame script is a stop action: stop(); Clip events are events that happen within a movie clip

7 Review In action script, what are statements composed of?
Name some event types.

8 Review Answers What are statements composed of? Name some event types.
Events and handlers Event - what the user does Handler - what the computer does in response Name some event types. Mouse / keyboard events Clip events

9 Syntax Most Common Functions: “on,” “stop” and “play”
Event Target: Triggers function (written in parenthesis) Event Handler Function (Action): How do you want the playhead to respond and where do you want the playhead to go? {how – written inside of curly brackets (where – written in parenthesis)} English sentences end with a period; ActionScript statements end with a semicolon on (release) { on (keypress “<Home>”) { gotoandplay(5); gotoandplay(1); } }

10 Syntax Examples on (release) { on (keypress “<Home>”) {
gotoandplay(5); gotoandplay(1); } Functions – on, stop, play Function? Event Target – triggers function Event Target? Event Handler (Action) Event Handler (Action)? How should the playhead respond? How? Where? Where do you want the playhead to go? Statement End? End of statement (semicolon)

11 Actions Actions are used for playhead control
Common Action Event Types Frame Actions Stop(); Play(); Button Actions Goto(); Gotoandplay(); Gotoandstop();

12 Syntax Frame actions are events that occur when the playhead reaches the frame. Function (); stop (); Button actions are events that occur when a button is pressed and released. Function (Event Target) { How (Where); } on (release) { gotoandplay(1);

13 Review How is the end of an action script statement signified?
What syntactical elements must be included for a statement to be executed? HINT: on (release) { gotoandplay(5); } What are actions used for? Name a common frame action. Name 2 button actions.

14 Review How is the end of an action script statement signified?
With a semicolon What syntactical elements must be included for a button statement to be executed? HINT: on (release) { Function (Event Target) { gotoandplay(5); How (Where); } } What are actions used for? Playhead control Name a common frame action: stop(); Name 2 button actions: gotoandstop(); gotoandplay()

15 Summary ActionScript is Flash’s programming language. In this presentation we defined and examined ActionScript, how to compose it’s statements and their syntax. We also discussed mouse, keyboard, frame and clip event types.


Download ppt "ActionScript Basics 2016 (2.0 – 3.0)"

Similar presentations


Ads by Google