Actionscript 3.0 Cookbook

( 3 )


Well before Ajax and Microsoft's Windows Presentation Foundation hit the scene, Macromedia offered the first method for building web pages with the responsiveness and functionality of desktop programs with its Flash-based "Rich Internet Applications". Now, new owner Adobe is taking Flash and its powerful capabilities beyond the Web and making it a full-fledged development environment.

Rather than focus on theory, the ActionScript 3.0 Cookbook concentrates on the practical ...

See more details below
$29.45 price
(Save 26%)$39.99 List Price
Other sellers (Paperback)
  • All (64) from $1.99   
  • New (7) from $8.51   
  • Used (57) from $1.99   
ActionScript 3.0 Cookbook: Solutions for Flash Platform and Flex Application Developers

Available on NOOK devices and apps  
  • NOOK Devices
  • Samsung Galaxy Tab 4 NOOK 7.0
  • Samsung Galaxy Tab 4 NOOK 10.1
  • NOOK HD Tablet
  • NOOK HD+ Tablet
  • NOOK eReaders
  • NOOK Color
  • NOOK Tablet
  • Tablet/Phone
  • NOOK for Windows 8 Tablet
  • NOOK for iOS
  • NOOK for Android
  • NOOK Kids for iPad
  • PC/Mac
  • NOOK for Windows 8
  • NOOK for PC
  • NOOK for Mac
  • NOOK for Web

Want a NOOK? Explore Now

NOOK Book (eBook)
$17.99 price
(Save 43%)$31.99 List Price


Well before Ajax and Microsoft's Windows Presentation Foundation hit the scene, Macromedia offered the first method for building web pages with the responsiveness and functionality of desktop programs with its Flash-based "Rich Internet Applications". Now, new owner Adobe is taking Flash and its powerful capabilities beyond the Web and making it a full-fledged development environment.

Rather than focus on theory, the ActionScript 3.0 Cookbook concentrates on the practical application of ActionScript, with more than 300 solutions you can use to solve a wide range of common coding dilemmas. You'll find recipes that show you how to:

  • Detect the user's Flash Player version or their operating system
  • Build custom classes
  • Format dates and currency types
  • Work with strings
  • Build user interface components
  • Work with audio and video
  • Make remote procedure calls using Flash Remoting and web services
  • Load, send, and search XML data
  • And much, much more ...

Each code recipe presents the Problem, Solution, and Discussion of how you can use it in other ways or personalize it for your own needs, and why it works. You can quickly locate the recipe that most closely matches your situation and get the solution without reading the whole book to understand the underlying code. Solutions progress from short recipes for small problems to more complex scripts for thornier riddles, and the discussions offer a deeper analysis for resolving similar issues in the future, along with possible design choices and ramifications. You'll even learn how to link modular ActionScript pieces together to create rock-solid solutions for Flex 2 and Flash applications.

When you're not sure how ActionScript 3.0 works or how to approach a specific programming dilemma, you can simply pick up the book, flip to the relevant recipe(s), and quickly find the solution you're looking for.

Adobe Developer Library is a co-publishing partnership between O'Reilly Media and Adobe Systems, Inc. and is designed to produce the number one information resources for developers who use Adobe technologies. Created in 2006, the Adobe Developer Library is the official source for comprehensive learning solutions to help developers create expressive and interactive web applications that can reach virtually anyone on any platform. With top-notch books and innovative online resources covering the latest in rich Internet application development, the Adobe Developer Library offers expert training and in-depth resources, straight from the source.

Rather than focus on ActionScript in the abstract, the book puts theory into practice with ready-made answers to common problems. Readers will find more than 300 worked-out scripts they can use to solve a wide range of coding dilemmas, while learning practical techniques for resolving similar issues in the future.

Read More Show Less

Product Details

  • ISBN-13: 9780596526955
  • Publisher: O'Reilly Media, Incorporated
  • Publication date: 10/18/2006
  • Series: Adobe Developer Library
  • Edition number: 1
  • Pages: 588
  • Product dimensions: 6.96 (w) x 10.86 (h) x 1.09 (d)

Meet the Author

Joey Lott is the author of several O'Reilly books on Macromedia technology, including Flash 8 Cookbook, Programming Flash Communication Server, and the ActionScript Cookbook. He is also the author of Flash 8 ActionScript Bible (Wiley) and Advanced ActionScript with Design Patterns (Adobe Press, October 2006). Joey has been teaching Flash and ActionScript since 1999. His professional experience in the Internet industry includes co-founding RightSpring, Inc., as well as consulting for YourMobile/Premium Wireless Services (J2EE B2C application) and (leading the development of a J2EE B2B application).

Darron Schall is an independent consultant specializing in the Flash Platform, with a Bachelor's Degree in Computer Science from Lehigh University. He has been using ActionScript since the early days and is a prominent voice in the Flash and Flex communities. He is actively involved in the Open Source Flash movement with projects ranging from software development tools to a Commodore 64 emulator. Darron has spoken at various conferences about ActionScript, and has contributed to books and magazines. You can find his Flash Platform related weblog at

Keith Peters is a Flash developer in the Boston area. He has been working with Flash since 1999 and is currently a Senior Flash Developer at Brightcove ( Keith has been a contributing author to nine other books on Flash and ActionScript. His personal website,, features an active blog, over 700 open source Flash experiments, and lots of other random Flash-related stuff.

Read More Show Less

Table of Contents

What’s Not in This Book;
Flash Platform Naming Conventions;
The Code;
Audience for This Book;
How This Book Is Organized;
How to Use This Book;
Conventions Used in This Book;
Using Code Examples;
O’Reilly Cookbooks;
Safari® Enabled;
How to Contact Us;
About the Tech Reviewers;
Chapter 1: ActionScript Basics;
Creating an ActionScript Project;
Customizing the Properties of an Application;
Where to Place ActionScript Code;
How to Trace a Message;
Handling Events;
Responding to Mouse and Key Events;
Using Mathematical Operators;
Checking Equality or Comparing Values;
Performing Actions Conditionally;
Performing Complex Conditional Testing;
Repeating an Operation Many Times;
Repeating a Task over Time;
Creating Reusable Code;
Generalizing a Method to Enhance Reusability;
Exiting a Method;
Obtaining the Result of a Method;
Handling Errors;
Chapter 2: Custom Classes;
Creating a Custom Class;
Determining Where to Save a Class;
Creating Properties That Behave As Methods;
Creating Static Methods and Properties;
Creating Subclasses;
Implementing Subclass Versions of Superclass Methods;
Creating Constants;
Dispatching Events;
Chapter 3: Runtime Environment;
Detecting the Player Version;
Detecting the Operating System;
Checking the Player Type;
Checking the System Language;
Detecting Display Settings;
Scaling the Movie;
Changing the Alignment;
Hiding the Flash Player’s Menu Items;
Detecting the Device’s Audio Capabilities;
Detecting the Device’s Video Capabilities;
Prompting the User to Change Player Settings;
Dealing with System Security;
Chapter 4: Numbers and Math;
Representing Numbers in Different Bases;
Converting Between Different Number Systems;
Rounding Numbers;
Inserting Leading or Trailing Zeros or Spaces;
Formatting Numbers for Display Without a Mask;
Formatting Currency Amounts;
Generating a Random Number;
Simulating a Coin Toss;
Simulating Dice;
Simulating Playing Cards;
Generating a Unique Number;
Converting Angle Measurements;
Calculating the Distance Between Two Points;
Determining Points Along a Circle;
Converting Between Units of Measurement;
Chapter 5: Arrays;
Adding Elements to the Start or End of an Array;
Looping Through an Array;
Searching for Matching Elements in an Array;
Removing Elements;
Inserting Elements in the Middle of an Array;
Converting a String to an Array;
Converting an Array to a String;
Creating a Separate Copy of an Array;
Storing Complex or Multidimensional Data;
Sorting or Reversing an Array;
Implementing a Custom Sort;
Randomizing the Elements of an Array;
Getting the Minimum or Maximum Element;
Comparing Arrays;
Creating an Associative Array;
Reading Elements of an Associative Array;
Chapter 6: Display List;
Adding an Item to the Display List;
Removing an Item from the Display List;
Moving Objects Forward and Backward;
Creating Custom Visual Classes;
Creating Simple Buttons;
Loading External Images at Runtime;
Loading and Interacting with External Movies;
Creating Mouse Interactions;
Dragging and Dropping Objects with the Mouse;
Chapter 7: Drawing and Masking;
Setting a Line Style;
Setting Gradient Line Styles;
Drawing a Line;
Drawing a Curve;
Drawing an Arc;
Drawing a Rectangle;
Drawing a Circle;
Drawing an Ellipse;
Drawing a Triangle;
Drawing Regular Polygons;
Drawing a Star;
Filling a Shape with a Solid or Translucent Color;
Filling a Shape with a Gradient;
Filling a Shape with a Bitmap;
Scripting Masks;
Chapter 8: Bitmaps;
Creating a BitmapData Object;
Adding a Bitmap to the Display List;
Drawing a Display Object to a Bitmap;
Loading an External Image into a Bitmap;
Manipulating Pixels;
Creating Rectangular Fills;
Creating a Flood Fill;
Copying Pixels;
Copying Channels;
Creating Noise;
Creating Perlin Noise;
Using Threshold;
Applying a Filter to a Bitmap;
Dissolving Between Two Bitmaps;
Scrolling a Bitmap;
Chapter 9: Text;
Creating an Outline Around a Text Field;
Creating a Background for a Text Field;
Making a User Input Field;
Making a Password Input Field;
Filtering Text Input;
Setting a Field’s Maximum Length;
Displaying Text;
Displaying HTML-Formatted Text;
Condensing Whitespace;
Sizing Text Fields to Fit Contents;
Scrolling Text Programmatically;
Responding to Scroll Events;
Formatting Text;
Formatting User-Input Text;
Formatting a Portion of Existing Text;
Setting a Text Field’s Font;
Embedding Fonts;
Creating Text that Can Be Rotated;
Displaying Unicode Text;
Assigning Focus to a Text Field;
Selecting Text with ActionScript;
Setting the Insertion Point in a Text Field;
Responding When Text Is Selected or Deselected;
Responding to User Text Entry;
Adding a Hyperlink to Text;
Calling ActionScript from Hyperlinks;
Working with Advanced Text Layout;
Applying Advanced Anti-Aliasing;
Replacing Text;
Retrieving a List of System Fonts;
Chapter 10: Filters and Transforms;
Applying Color Changes;
Applying Color Tints;
Resetting Color;
Applying Basic Filters;
Applying Advanced Filter Effects (Emboss, etc.);
Detecting Edges;
Making a Digital Negative;
Applying Grayscale;
Changing Saturation;
Changing Brightness;
Changing Contrast;
Chapter 11: Programmatic Animation;
Moving an Object;
Moving an Object in a Specific Direction;
Using Trigonometry;
Applying Animation Techniques to Other Properties;
Chapter 12: Strings;
Joining Strings;
Using Quotes and Apostrophes in Strings;
Inserting Special Whitespace Characters;
Searching for a Substring;
Extracting a Substring;
Parsing a String into Words;
Removing and Replacing Characters and Words;
Retrieving One Character at a Time;
Converting Case;
Trimming Whitespace;
Reversing a String by Word or by Character;
Converting Between Strings and Unicode or ASCII;
Chapter 13: Regular Expressions;
Understanding Regular Expression Patterns;
Testing Regular Expressions;
Looking for Pattern Matches;
Removing and Replacing Characters and Words Using Patterns;
Creating a Nongreedy Pattern;
Validating User Input with Common Patterns;
Chapter 14: Dates and Times;
Finding the Current Date and Time;
Retrieving the Date Values;
Retrieving the Day or Month Name;
Formatting the Date and Time;
Formatting Seconds or Milliseconds as Minutes and Seconds;
Converting Between DMYHMSM and Epoch Milliseconds;
Using Timers;
Calculating Elapsed Time or Intervals Between Dates;
Parsing a Date from a String;
Chapter 15: Programming Sound;
Creating a Sound Object and Loading a Sound;
Starting and Stopping a Sound;
Setting the Buffer for a Sound;
Offsetting the Start of a Sound;
Playing a Sound Multiple Times (Looping);
Getting the Size of a Sound File;
Reading the ID3 Tag of a Sound File;
Find Out When a Sound Finishes Playing;
Tracking the Progress of a Playing Sound;
Pausing and Restarting a Sound;
Reading the Level of a Sound;
Stopping All Sounds;
Reading the Sound Spectrum;
Changing the Volume or Pan of a Sound;
Creating a Sound Application;
Chapter 16: Video;
Loading and Playing Back Video;
Controlling Video Sound;
Reading Playback Time;
Reading Video Duration;
Controlling Playback Time;
Scaling Video;
Managing and Monitoring Buffering and Loading;
Listening for Cue Points;
Applying Filters to Video;
Pausing and Resuming Video;
Stopping Video;
Scrubbing Video;
Clearing the Video Display;
Determining User Bandwidth;
Chapter 17: Storing Persistent Data;
Creating and Opening a Local Shared Object;
Writing Data to a Shared Object;
Saving a Local Shared Object;
Reading Data from a Shared Object;
Removing Data from a Shared Object;
Serializing Custom Classes;
Sharing Data Between Flash Applications;
Controlling the Size of Local Shared Objects;
Chapter 18: Communicating with Other Movies;
Creating Local Connections;
Sending Data;
Validating Receipt of Communication over Local Connections;
Accepting Local Communications from Other Domains;
Chapter 19: Sending and Loading Data;
Loading Variables from a Text File;
Loading Variables from a Server-Side Script;
Loading a Block of Text (Including HTML and XML);
Checking Load Progress;
Accessing Data Being Downloaded;
Sending Data to a Server-Side Script;
Sending Variables and Handling a Returned Result;
Chapter 20: XML;
Understanding XML Structure (Reading and Writing XML);
Creating an XML Object;
Adding Elements to an XML Object;
Adding Text Nodes to an XML Object;
Adding Attributes to an XML Element;
Reading Elements in an XML Tree;
Finding Elements by Name;
Reading Text Nodes and Their Values;
Reading an Element’s Attributes;
Removing Elements, Text Nodes, and Attributes;
Loading XML;
Loading XML from Different Domains;
Sending XML;
Searching XML;
Using HTML and Special Characters in XML;
Chapter 21: Web Services and Flash Remoting;
Calling Web Services Methods;
Handling Web Services Responses;
Handling Web Services Errors;
Calling Flash Remoting Methods;
Handling Flash Remoting Responses;
Chapter 22: Building Integrated Applications;
Calling JavaScript Functions;
Calling ActionScript Functions;
Passing Parameters from HTML;
Chapter 23: File Management;
Downloading Files;
Detecting When a User Selects a File to Upload;
Monitoring Download Progress;
Browsing for Files;
Filtering Files That Display in the Browser Window;
Detecting When the User Has Selected a File to Upload;
Uploading Files;
Monitoring File Upload Progress;
Chapter 24: Socket Programming;
Connecting to a Socket Server;
Sending Data;
Receiving Data;
Handshaking with a Socket Server;
Disconnecting from a Socket Server;
Handling Socket Errors;
Appendix 1: Unicode Escape Sequences for Latin 1 Characters;

Read More Show Less

Customer Reviews

Average Rating 3.5
( 3 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Terms of Use.
  • - Barnes & reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing all of 3 Customer Reviews
  • Anonymous

    Posted June 24, 2013

    Helpful only for some!

    This book seems to be geared towards people who are unfamiliar with actionscript 3.0 in particular. It highlights several differences between the latest version of actionscript and previous ones. Generally, I found the topics discussed to be very broad and kind of simple. At the risk of sounding pompous I have to say that I am new actionscript programming, but I did not find this book very useful even if well written.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted December 12, 2006

    A must have.

    I've using FLEX since its 1.0 beta days, and can honestly say that each day I learn something new about this language. It's even better when you have the 'cheat codes' for the game in which we play, FLEX development. This book has quite comprehensive repositories of good ol fashion FLEX recipes and are relevant to the average FLEX developer out there. It's not so much for the newbie¿s, but it doesn't count them out either as it finds a nice balance in helping folks learn from Code instead of FLEX 101 lessons. As others have hinted, the focus on DisplayLists will open a few minds to the possibilities of how easy they are and the concept of re-parenting is something that most will not be able to grasp. I'd rate this book to be a must have for anyone using FLEX right now, and if you're a FLASH developer of old, moving into the ranks of FLEX then this has to be a first purchase. I don't usually give glowing references like this to books, and so its rare I talk it up like I have but its a great book written by some serious propeller heads who have the respect of their peers within the FLEX 'who's who'.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted October 26, 2009

    No text was provided for this review.

Sort by: Showing all of 3 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)