77 of 102 people found the following review helpful:
5.0 out of 5 stars
A great addition to your ActionScript knowledge base, October 28, 2006
This review is from: ActionScript 3.0 Cookbook: Solutions for Flash Platform and Flex Application Developers (Paperback)
This book is in the style of the classic O'Reilly Cookbook series format, in which each recipe presents the problem, the solution, and a discussion of the solution. Each section pretty much stands alone, although you should understand chapter one on the basics before moving on. The Discussion sections of each recipe offer a good analysis of how the solution works and different design choices and their various ramifications. Thus you get the best of both worlds - quick and easy access to the answers you want and deeper insights into the nature of both the problem and the solution. This book is helping me develop my understanding of ActionScript concepts by applying them in real situations and I highly recommend it.
All of the code examples in this book are based on ActionScript 3.0 and only compatible with products that support ActionScript 3.0. Flex 2.0 and Flash 9 allow you to author ActionScript 3.0 content. Flash Player 9 supports ActionScript 3.0. If you are using a product that does not support ActionScript 3.0, then the code in this book is not likely to work.
The following is the table of contents:
Chapter 1. ActionScript Basics
Recipe 1.1. Creating an ActionScript Project
Recipe 1.2. Customizing the Properties of an Application
Recipe 1.3. Where to Place ActionScript Code
Recipe 1.4. How to Trace a Message
Recipe 1.5. Handling Events
Recipe 1.6. Responding to Mouse and Key Events
Recipe 1.7. Using Mathematical Operators
Recipe 1.8. Checking Equality or Comparing Values
Recipe 1.9. Performing Actions Conditionally
Recipe 1.10. Performing Complex Conditional Testing
Recipe 1.11. Repeating an Operation Many Times
Recipe 1.12. Repeating a Task over Time
Recipe 1.13. Creating Reusable Code
Recipe 1.14. Generalizing a Method to Enhance Reusability
Recipe 1.15. Exiting a Method
Recipe 1.16. Obtaining the Result of a Method
Recipe 1.17. Handling Errors
Chapter 2. Custom Classes
Classes are absolutely essential to ActionScript 3.0. This is truer in ActionScript 3.0 than in any earlier release of the language. ActionScript 1.0 was essentially a procedural language with modest object-oriented features. ActionScript 2.0 formalized the object-oriented features and took a big step in the direction of a truly object-oriented language. However, ActionScript 3.0 shifts the core focus of ActionScript so that the basic building block is that of the class. If you are using ActionScript 3.0 with Flex, and the introduction of the minor exception of code being placed within mx_Script tags, all ActionScript code must appear within a class. This chapter discusses the fundamentals of writing custom classes in ActionScript 3.0.
Recipe 2.1. Creating a Custom Class
Recipe 2.2. Determining Where to Save a Class
Recipe 2.3. Creating Properties That Behave As Methods
Recipe 2.4. Creating Static Methods and Properties
Recipe 2.5. Creating Subclasses
Recipe 2.6. Implementing Subclass Versions of Superclass Methods
Recipe 2.7. Creating Constants
Recipe 2.8. Dispatching Events
Chapter 3. Runtime Environment
Flash Player 9 offers a relatively large amount of information about and control over the runtime environment. The flash.system.Capabilities class has many static methods that return information about the player and the computer on which it is running, such as the operating system, language, audio, and video capabilities. There are other classes such as flash.display.Stage and flash.system.Security that allow you to control other elements of the Player such as the right-click menu under Windows (Control-click on the Macintosh) and the Settings dialog box. The flash.display.Stage class also controls the scaling and alignment of the movie within the Player.
Recipe 3.1. Detecting the Player Version
Recipe 3.2. Detecting the Operating System
Recipe 3.3. Checking the Player Type
Recipe 3.4. Checking the System Language
Recipe 3.5. Detecting Display Settings
Recipe 3.6. Scaling the Movie
Recipe 3.7. Changing the Alignment
Recipe 3.8. Hiding the Flash Player's Menu Items
Recipe 3.9. Detecting the Device's Audio Capabilities
Recipe 3.10. Detecting the Device's Video Capabilities
Recipe 3.11. Prompting the User to Change Player Settings
Recipe 3.12. Dealing with System Security
Chapter 4. Numbers and Math
ActionScript 3.0 has three basic numeric types: number, int, and uint. number is for any floating-point numbers, whereas int and uint are for integers (whole numbers). The distinction between int and uint is that int is the set of negative and non-negative integers, while uint is the set of non-negative integers (unsigned integers). This chapter gives you examples of working with all types of numbers in ActionScript using a variety of mathematical applications.
Recipe 4.1. Representing Numbers in Different Bases
Recipe 4.2. Converting Between Different Number Systems
Recipe 4.3. Rounding Numbers
Recipe 4.4. Inserting Leading or Trailing Zeros or Spaces
Recipe 4.5. Formatting Numbers for Display Without a Mask
Recipe 4.6. Formatting Currency Amounts
Recipe 4.7. Generating a Random Number
Recipe 4.8. Simulating a Coin Toss
Recipe 4.9. Simulating Dice
Recipe 4.10. Simulating Playing Cards
Recipe 4.11. Generating a Unique Number
Recipe 4.12. Converting Angle Measurements
Recipe 4.13. Calculating the Distance Between Two Points
Recipe 4.14. Determining Points Along a Circle
Recipe 4.15. Converting Between Units of Measurement
Chapter 5. Arrays
In ActionScript, there are two kinds of arrays: integer-indexed and associative. Both array types group related data, but they use different means of accessing the data. The integer-indexed array uses integers as unique identifiers for each element in the array. Associative arrays use string keys to access each value. There's more about associative arrays in Recipe 5.15. This chapter will remind you of any good chapter in any book on arrays in any programming language.
Recipe 5.1. Adding Elements to the Start or End of an Array
Recipe 5.2. Looping Through an Array
Recipe 5.3. Searching for Matching Elements in an Array
Recipe 5.4. Removing Elements
Recipe 5.5. Inserting Elements in the Middle of an Array
Recipe 5.6. Converting a String to an Array
Recipe 5.7. Converting an Array to a String
Recipe 5.8. Creating a Separate Copy of an Array
Recipe 5.9. Storing Complex or Multidimensional Data
Recipe 5.10. Sorting or Reversing an Array
Recipe 5.11. Implementing a Custom Sort
Recipe 5.12. Randomizing the Elements of an Array
Recipe 5.13. Getting the Minimum or Maximum Element
Recipe 5.14. Comparing Arrays
Recipe 5.15. Creating an Associative Array
Recipe 5.16. Reading Elements of an Associative Array
Chapter 6. Display List
The rendering model for ActionScript 3.0 and Flash Player 9 is radically different than in previous versions. The new renderer is still hierarchical, but not as rigid, and aims to simplify and optimize the rendering process. The new rendering model centers on the display list concept and focuses on the classes available in the flash.display package. The display list is a hierarchy that contains all visible objects in the .swf movie. Any object not on the display list is not drawn by the renderer. Each .swf movie contains exactly one display list, which is comprised of three types of elements: the stage, display object container, and display objects. This chapter gives you practice working with this new model.
Recipe 6.1. Adding an Item to the Display List
Recipe 6.2. Removing an Item from the Display List
Recipe 6.3. Moving Objects Forward and Backward
Recipe 6.4. Creating Custom Visual Classes
Recipe 6.5. Creating Simple Buttons
Recipe 6.6. Loading External Images at Runtime
Recipe 6.7. Loading and Interacting with External Movies
Recipe 6.8. Creating Mouse Interactions
Recipe 6.9. Dragging and Dropping Objects with the Mouse
Chapter 7. Drawing and Masking
With ActionScript, you can programmatically draw many display objects such as Shape, Sprite, Button, and MovieClip. Each of these classes has a graphics property that is an instance of the flash.display.Graphics class. The Graphics class defines an API for drawing content programmatically. Most recipes in this chapter discuss how to use the Graphics class API.
Recipe 7.1. Setting a Line Style
Recipe 7.2. Setting Gradient Line Styles
Recipe 7.3. Drawing a Line
Recipe 7.4. Drawing a Curve
Recipe 7.5. Drawing an Arc
Recipe 7.6. Drawing a Rectangle
Recipe 7.7. Drawing a Circle
Recipe 7.8. Drawing an Ellipse
Recipe 7.9. Drawing a Triangle
Recipe 7.10. Drawing Regular Polygons
Recipe 7.11. Drawing a Star
Recipe 7.12. Filling a Shape with a Solid or Translucent Color
Recipe 7.13. Filling a Shape with a Gradient
Recipe 7.14. Filling a Shape with a Bitmap
Recipe 7.15. Scripting Masks
Chapter 8. Bitmaps
Before Flash 8, support for bitmap images was minimal. Although they could be loaded and displayed, there wasn't much you could do with them at runtime. The BitmapData class offers a nice set of tools for creating and manipulating bitmap graphics at runtime in Flash, and is featured in this chapter.
Recipe 8.1. Creating a BitmapData Object
Recipe 8.2. Adding a Bitmap to the Display List
Recipe 8.3. Drawing a Display...
Read more ›
Help other customers find the most helpful reviews
Was this review helpful to you? Yes
No