Accessibility

ActionScript Article

 

Building an image-viewing widget with ActionScript 3.0


Colin Moock

Colin Moock

moock.org

Table of Contents

Created:
27 June 2006
User Level:
Intermediate

Along with the launch of Macromedia Flash MX 2004 back in 2003 came ActionScript 2.0, the first version of the Flash programming language to support a true object-oriented programming syntax. ActionScript 2.0 marked a great step forward for Flash programming, but it still lacked some of the functionality that programmers familiar with Java, C++, and other object-oriented languages would expect. All this is about to change with ActionScript 3.0, which represents a turbo-charged upgrade to the core language as well as a no-holds-barred overhaul of the Flash Player API.

Years in the making, ActionScript 3.0 presents perhaps the most substantial upgrade to the Flash programming language ever. The enhancements to the performance, feature set, ease of use, cleanliness, and sophistication of ActionScript are simply staggering. In this article, I present four versions of a simple image-viewing widget used to load, display, crop, and add a border around an image. I introduced the code for this widget in my book, Essential ActionScript 2.0. The samples presented in this article demonstrate how this image viewer would be implemented with ActionScript 3.0.

Requirements

To make the most of this article, you need to install the following software and files:

Flex Builder 2 (SDK Included)

Free Flex 2 SDK (Included with Flex Builder 2)

Sample files:

Prerequisite knowledge:

Familiarity with ActionScript 2.0 and object-oriented programming.

About the author

Colin Moock is the author of five best-selling books on ActionScript, all published by O'Reilly Media, Inc. Moock's works include ActionScript: The Definitive Guide, ActionScript: The Definitive Guide for Flash MX, Essential ActionScript 2.0, and Essential ActionScript 3.0. Moock is a regular speaker at international Flash industry conferences, including FITC, Flash Forward, and Adobe MAX.