ActionScript Code Samples

Simple Examples

Traditional Hello World program
Another Traditional Hello World program
Demonstration of Creating Shapes
Demonstration of Line Draw
Demonstration of Line Draw 2
Demonstration of Rounded Rectangles for buttons
Let's do some simple math
Now we need to look at doing simple mouse events
We use the mouse events OVER and OUT
Introduction to various data types
More on data types

Some Fun Stuff

Simple static text
Demonstration of Dynamic Text
We can change the transparency of objects.
Push button with dynamic text
External text to use with our loader
Push button with static text

Formatting Text

Simple TextFormat
Same thing but using the contructor for an easier approach
Formatting a segment of text
Formatting Arabic
Some of the string handling functions in ActionScript

Iteration and Logic

Fun with true and false
Simple for next loop
Simple while loop
Another while loop
Do loop
For in loop

Classes

A shell of a class. This is so empty we don't even try to run it.
This is a simple, run-able class. To run it, you need both the .fla and .as files in the same folder.
We demonstrate some other features of classes in general.
And one last class to seal the deal. A nice class to demonstrate using one, but not contrived.
A new Hello World program, this time with Classes and dynamic text.
Even more fun with our dynamic text.
Formatting dynamic text.
Paragraph formatting of dynamic text.
A practical example of using a class.

Page Counters

A demo of the progress counter. Note that there are embedded instructions. This will take about an hour to walk through.
A completed example but I wouldn't recommend using it as a working example, but only to see where you may have errored.

Arrays

Simple array
Fun with arrays
Arrays using push and pop

Multimedia Loaders

Load and display external text.
Play a sound included in the library.
Load external swf files.
Load an mp3. No controls included.
Load an mp3, controls included.

Intro to Animation

Ball bouncing on stage