These ActionScript 3 samples demonstrate various features common in Adobe Flash Professional CS5 development. Some samples are complete applications, while others simply introduce a concept that you can use to build your own apps. Use these files to investigate how each of the samples was constructed. Explore the graphics and timelines in the FLA files, and explore the ActionScript code in the associated AS files.
 
Samples are rated Beginning, Intermediate, and Advanced. Intermediate developers and people with prior experience in ActionScript 2 will be interested in looking at the code to see how it works in ActionScript 3.
 
Download source files for all samples:
 
You can also download individual source files on each sample's detail page below.
 
Note: You may reuse these files as you want, but they are not officially supported as part of the product. Technical support will not be able to answer questions about these files. (Archive of ActionScript 3 samples for Flash CS3 Professional are still available.)
 
The samples and related concepts are grouped into the following categories:

Drawing samples
ActionScript 3 has access to most aspects of the SWF environment. The first step to understanding how to work with ActionScript 3 is to understand how it relates to the visual environment. SWF applications are composed of timelines (movie clips or sprites) that act as containers for content and code. In ActionScript 3, timelines are display object containers and the visual elements within them are called display objects. The following samples explore timelines, coordinate space, and ActionScript built-in drawing and color controls:

Explore timeline coordinates and the distance and angle between points.
(User level: Beginning)
 
Explore the effects of animating two-dimensional objects in 3D space.
(User level: Beginning)
 
Explore the effects of timeline nesting and graphic placement within timelines.
(User level: Beginning)

 
Explore animated patterns created with the Deco tool in 3D space.
(User level: Intermediate)

 
Explore the built-in drawing tools available in sprites and movie clips.
(User level: Intermediate)

 
Explore the transitions available in ActionScript 3.
(User level: Beginning)

Explore color transformations on display objects.
(User level: Intermediate)


Media samples
Sounds, images, and text can be used to enhance the content in your project. Adobe Flash Player has the ability to use external or embedded media. ActionScript 3 has greater control over media usage and media related events. The following samples highlight how to use text, images, and sound in your project:

Explore a simple paycheck calculator that uses Flash text fields and component text inputs to display dynamic text.
(User level: Intermediate)
 
Explore more in-depth sound controls in this mixing board sample.
(User level: Advanced)
 
Explore a simple image loader and slide show application.
(User level: Beginning)
 
Explore the sound generation capabilities in Flash Player 10 and later.
(User level: Intermediate)
 
Explore three types of masking effects used over bitmap images.
(User level: Beginning)
Explore how to use CSS to format a Classic text field using HTML text.
(User level: Intermediate)
 
Explore a sample that loads sounds and provides a basic set of custom controls.
(User level: Intermediate)
Explore how to use CSS to format a TLF text field using both HTML text and TLF markup text.
(User level: Intermediate)

Component samples
One of the strengths of ActionScript is its ability to create organized, reusable components. Flash Professional CS5 ships with a set of built-in user interface components for ActionScript 2 and ActionScript 3. You can also build your own custom components. The following samples show built-in and custom components in action:

Explore video playback using the ActionScript 3 FLVPlayback component.
(User level: Beginning)
Explore a custom-built ArcadeButton component with author-time Live Preview.
(User level: Intermediate)
Note: To learn more about components, check out the Using ActionScript 3.0 Components documentation for Flash Professional CS5.


Time samples
There are many occasions when you need to know the viewer's local time and date or the elapsed time in a movie (SWF file). Displaying the date and time in a user interface or the elapsed time during a game or interaction is an easy way to generate interest and a sense of change. The following samples show two approaches for handling time:

Explore an example of a stopwatch-style timer.
(User level: Intermediate)
Explore an example of a clock that displays the computer's local time.
(User level: Beginning)

Interactivity samples
Flash Professional CS5 is a great tool for building games, learning interactions, and interactive environments. ActionScript 3 expands the options available to developers, allowing for creative solutions to old design problems. You can use the built-in components or build custom controls to create interactive elements in your movie. The following samples create animations through a series of interactive controls:

Explore an interactive screen where an animation is controlled by buttons.
(User level: Intermediate)
 
Click-controlled movement
Explore an interactive screen where an animation is controlled by click location.
(User level: Intermediate)
 
Explore an interactive screen where an animation is controlled by sliders.
(User level: Intermediate)
 
Explore an interactive screen where keyboard controls change the thrust of an animation.
(User level: Intermediate)
 
Explore an interactive screen where an animation is controlled by a virtual joystick.
(User level: Intermediate)
 
Explore an interactive screen where sliders control a dynamically generated sky background.
(User level: Intermediate)
 
Explore an interactive screen where an animation is controlled by keyboard presses.
(User level: Intermediate)
Explore an animation built with the inverse kinematics feature in Flash.
(User level: Intermediate)

Game samples
Flash Professional CS5 is a great tool for building games, learning interactions, and interactive environments. ActionScript 3 expands the options available to developers, allowing for creative solutions to old design problems. You can use the built-in components or build custom controls to create interactive elements in your movie. The following samples create animations through a series of interactive controls:

Explore a maze game where arrow keystrokes control player movement through the boundaries of a maze pattern.
(User level: Intermediate)
Explore a starship game where obstacles and laser fire are dynamically generated through building game levels.
(User level: Advanced)

Flash Professional samples
One of the quickest ways to learn Flash Professional is to look at existing sample files to see how they are built. See links to several Flash samples, with instructions on how to use them, including video templates and ActionScript 3 components samples provided by the documentation team.
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. Permissions beyond the scope of this license, pertaining to the examples of code included within this work are available at Adobe.
  

ActionScript      Adobe Animate CC      animation      components      gaming      video