sfmultimedia.net

sfmultimedia :: actionscript salons :: as fundamentals

Actionscript Fundamentals

This material was presented to students at Ex'pression College in Emeryville July 26, 2005. It is an update of Salon #3.

If you're basically living in an

on (press)

and

gotoAndPlay(10)

world, this presentation is a great place to start. We cover Flash structure, dot syntax, variables, functions and branching behavior. In short, we explain all those little essentials which can get you away from the timeline and into code.

BEAR IN MIND THAT SOME OF THE AUTHORING .FLAs ARE MX 2004.

Relevance/availability: the information provided here is intended for the beginner. As such, most of it remains relevant today. The files are mostly authored in Flash MX 2004.

Presentation slides (swf)

Scope. I didn't actually show this one at the presentation. Opening and playing with this file might help illuminate the idea of scope for anyone who is still having trouble with the concept.

View the swf
Download the fla

The Ship. Remember my exciting ship animation? Well here it is in all it's glory. This example shows how one timeline can target another (and make it go someplace!).

View the swf
Download the fla

Branching. A simple if...else if...else example.

View the swf
Download the fla

Buttons and Decisions. More complex. We show: (1) button code, (2) decision trees, and (3) variables. The button code should be self-evident when you see the examples. The decision tree uses the syntax:

if (something){
   execute some code;
} else if (something else){
   execute so different code;
} else {
   execute yet another bit of code;
}

If the 'something' inside the parenthesis resolves to 'true', then everything within the following brackets will be executed. When we use 'else' without an 'if (something else)' we're saying 'if nothing else happens, do this'.

View the swf
Download the fla

Functions. A very simple example showing how to use a function.

View the swf
Download the fla

Flying box fields . The primary lesson here is to see how a variable can stand in for a MovieClip, but we also have further examples of variables, functions and scope.

View the swf
Download the fla