-
Local Recipes
-
Chapter 1 ActionScript Basics
- Introduction
- Using Mathematical Operators
- Checking Equality or Comparing Values
- Performing Actions Conditionally
- Performing Complex Conditional Testing
- Repeating an Operation Many Times
- Performing an Action Once per Frame Update
- Repeating a Task at Timed Intervals
- Creating Reusable Code
- Generalizing a Function to Enhance Reusability
- Exiting a Function
- Obtaining the Result of a Function
- Avoiding Conflicting Variables
- Reusing and Organizing Code in Multiple Movies
-
Chapter 2 Runtime Environment
- Introduction
- Detecting the Player Version
- Detecting the Operating System
- Checking the System Language
- Detecting Display Settings
- Scaling the Movie
- Changing the Alignment
- Detecting the Device's Audio Capabilities
- Prompting the User to Change Player Settings
- Hiding the Flash Player's Menu Items
- Enhancing Standalone Projectors
- Setting the Dimensions of a Projector
- Specifying Where on Screen a Projector Opens
-
Chapter 3 Color
- Introduction
- Setting the Color of a Movie Clip
- Specifying RGB Values
- Decoding an RGB Value
- Setting the RGB Relative to Its Current Value
- Tinting a Movie Clip's Color
- Setting a Movie Clip's Transparency
- Transforming a Movie Clip's Current Color
- Restoring a Movie Clip's Original Color
- Controlling a Movie Clip's Color with Sliders
-
Chapter 4 Drawing and Masking
- Introduction
- Drawing a Line
- Drawing a Curve
- Drawing a Rectangle
- Drawing a Rounded Rectangle
- Drawing a Circle
- Drawing an Ellipse
- Drawing a Triangle
- Drawing Regular Polygons
- Filling a Shape with a Solid or Translucent Color
- Filling a Shape with a Gradient
- Filling a Shape with a Complex Gradient
- Scripting Masks
-
Chapter 5 Numbers and Math
- Introduction
- Representing Numbers in Different Bases
- Converting Between Different Number Systems
- Rounding Numbers
- Inserting Leading or Trailing Zeros
- Formatting Numbers for Display
- Formatting Currency Amounts
- Generating a Random Number
- Simulating a Coin Flip
- 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
- Calculating Asset Appreciation (Future Value)
- Calculating Retirement Savings
- Calculating the Loan (Mortgage) You Can Afford
- Calculating Loan Amortization or Annuities
-
Chapter 6 Arrays
- Introduction
- 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
- Creating an Associative Array
- Reading Elements of an Associative Array
-
Chapter 7 Movie Clips
- Introduction
- Referring to Movie Clips via ActionScript
- Targeting Movie Clips with Dynamic Names
- Affecting Playback
- Reversing Playback
- Using Movie Clips as Buttons
- Defining Hit Areas for Movie Clips
- Checking for Mouseover
- Performing Repeated Actions on Movie Clips
- Fading a Movie Clip
- Discovering Nested Movie Clips
- Getting Unique Depths
- Getting a Movie Clip's Boundaries
- Creating a Draggable Movie Clip
- Creating a Custom Mouse Pointer
- Checking for Overlapping Movie Clips (Performing Hit Tests)
- Changing Stacking Order
- Converting Between Coordinate Spaces
- Duplicating Movie Clips
- Adding Movie Clips from the Library with ActionScript
-
Chapter 8 Text
- Introduction
- Referring to a Text Field via ActionScript
- Creating a Text Field
- 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
- Restricting the Maximum Field Length
- Displaying Dynamic Text at Runtime
- Displaying HTML-Formatted Text
- Condensing Whitespace
- Sizing Text Fields to Fit Contents
- Scrolling Text with the ScrollBar Component
- Scrolling Text Programmatically
- Responding to Scroll Events
- Formatting Existing Text
- Formatting User-Input Text
- Formatting a Portion of a Text Field
- 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
-
Chapter 9 Strings
- Introduction
- Joining Strings
- Using Quotes and Apostrophes in Strings
- Inserting Special Whitespace Characters
- Searching for a Substring
- Extracting a Substring
- Matching Patterns with Regular Expressions
- Looking for a Pattern Match
- Parsing a String into Words
- Removing and Replacing Characters
- Processing One Character at a Time
- Converting Case
- Trimming Whitespace
- Reversing a String by Word or by Letter
- Converting Between Strings and Unicode or ASCII
-
Chapter 10 Dates and Times
- Introduction
- Finding the Current Date and Time
- Retrieving the Day or Month Name
- Formatting the Date and Time
- Formatting Milliseconds as Minutes and Seconds
- Converting Between DMYHMSM and Epoch Milliseconds
- Calculating Elapsed Time or Intervals Between Dates
- Parsing a Date from a String
- Creating Timers and Clocks
-
Chapter 11 Forms
- Introduction
- Adding UI Components at Runtime
- Positioning Form Elements
- Adding Menus to a Form
- Making Dependent Menus
- Resizing Menus to Fit Their Contents
- Detecting the Selected Menu Items
- Adding Radio Buttons to a Group
- Aligning Radio Buttons Automatically
- Getting the Selected Radio Button Value
- Adding Checkboxes to a Form
- Getting Checkbox Values
- Assembling an Advanced Form
- Submitting a Form
- Validating Form Input
- Alerting Users to Validation Errors
- Making a Multipage Form
- Submitting a Multipage Form
- Validating a Multipage Form
- Transmitting Data Securely
- Prepopulating a Form
- Customizing the Tab Order
- Using Tables to Arrange Form Elements
- Creating Auto-Complete Text Fields
- Customizing a Component's Appearance
- Customizing All Components' Appearances
-
Chapter 12 Objects and Custom Components
- Introduction
- Using Methods and Properties of Built-in Objects
- Creating an Instance of a Class
- Adding Properties to an Object Instance
- Adding Custom Methods to an Object Instance
- Creating a Custom Class
- Creating Smart Getter/Setter Properties
- Defining Read-Only Properties
- Creating Subclasses
- Implementing Subclass Versions of Superclass Methods
- Listening for Events
- Adding Listeners to Custom Classes
- Creating a Component That Subclasses MovieClip
- Program: Color Selector Component
-
Chapter 13 Programming Sound
- Introduction
- Creating an Object to Control Sound
- Attaching Sounds at Runtime
- Playing and Stopping a Sound
- Getting Playback Time
- Looping a Sound
- Setting In and Out Points
- Pausing and Resuming a Sound
- Performing Actions When a Sound Ends
- Queuing Sounds
- Adding Sounds to Buttons and UI Components
- Setting the Volume of a Sound
- Controlling the Panning of a Sound
- Creating Advanced Stereo Panning Effects
- Fading In a Sound
- Fading Out a Sound
- Program: A Sound Controller Component
-
-
Remote Recipes
-
Chapter 14 FlashCom Server
- Introduction
- Creating a New FlashCom Application
- Connecting to the FlashCom Server
- Adding a Video Object at Runtime
- Capturing and Displaying Video from a Web Cam
- Capturing and Playing Audio from a Microphone
- Controlling FlashCom Audio
- Subscribing to Audio/Video Content
- Creating Playlists
- Recording and Publishing Video and Audio
- Publishing Live Content
- Pausing and Resuming a Net Stream
- Fast-Forwarding and Rewinding a Net Stream
- Seeking Relative to the Total Stream Length
- Implementing Server-Side ActionScript
- Tracking Clients Connected to the Application
- Invoking Server-Side Functions from the Client Movie
- Invoking Client-Side Functions from the Server
-
Chapter 15 Loading Assets
- Introduction
- Loading an External SWF
- Loading an External SWF from a Trusting Domain
- Loading an External JPEG Image
- Loading an External Image (All Formats)
- Loading an External MP3 Sound
- Loading Remote Content by Proxy
- Determining if an Asset Is Loaded
- Getting the Percentage of an Asset That Has Loaded
- Monitoring Load Progress Using a Progress Bar Component
- Monitoring Load Progress Without a Progress Bar Component
- Performing Actions When the Asset Is Loaded
- Hiding the Graphics and Text for a Progress Bar
-
Chapter 16 Storing Persistent Information
- Introduction
- Storing and Retrieving Locally Persistent Information
- Adding Data to a Client-Side Shared Object
- Reading Values from a Client-Side Shared Object
- Saving a Local Shared Object
- Sharing Information Between Movies Within the Same Domain
- Storing Persistent Data on the Server
- Saving Remote Shared Object Data
- Checking for Updates to Remote Shared Objects
- Reading Values from a Server-Side Shared Object
- Adding Data to a Server-Side Shared Object
-
Chapter 17 Communicating with Other Movies
- Introduction
- Communicating with Other Movieson the Same Computer
- Sending Data Using Local Connections
- Validating Receipt of Communication Over a Local Connection
- Accepting Communications from Other Domains
- Communicating Between Movies on Different Computers
- Broadcasting Data to Remote Shared Object Clients
-
Chapter 18 Sending and Loading Variables
- Introduction
- Loading Variables from a Text File
- Loading Variables from a Server-Side Script
- Checking Load Progress
- Sending Data to a Server-Side Script
- Sending Variables and Handling a Returned Result
-
Chapter 19 XML
- Introduction
- Understanding XML Structure (Reading and Writing XML)
- Creating an XML Object
- Adding Elements to an XML Object
- Adding Text Nodes to an XML Object
- Creating an XML Object from an Array
- 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
- Loading XML
- Removing Extra Whitespace from XML Objects
- Sending XML
- Sending XML Data and Receiving a Response
- Searching XML
- Using XML Data to Initialize a Movie
-
Chapter 20 Flash Remoting
- Introduction
- Establishing a Connection via Flash Remoting
- Configuring Flash Remoting for ColdFusion
- Configuring Flash Remoting for .NET
- Configuring Flash Remoting for J2EE
- Configuring Flash Remoting for PHP or Perl
- Invoking a Remote Function on a Service
- Handling Flash Remoting Results
- Distinguishing Among Results from Multiple Calls to a Single Service
- Calling ASP.NET Functions from Flash
- Calling ColdFusion Functions from Flash
- Passing Named Parameters to ColdFusion Component Methods
- Passing Complex Parameters to ColdFusion Component Methods
- Calling Java or JSP Functions from Flash
- Transmitting Custom Datatypes to a Flash Remoting Back End
- Receiving Typed Objects with ColdFusion
- Receiving Typed Objects with ASP.NET
- Receiving Typed Objects with Java
- Returning Typed Objects from ColdFusion
- Returning Typed Objects from ASP.NET
- Returning Typed Objects from Java
- Writing Server-Side Functions in ActionScript
- Querying a Database with Server-Side ActionScript
- Making HTTP Requests with Server-Side ActionScript
- Consuming Web Services with Flash Remoting for .NET or ColdFusion
-
Chapter 21 Recordsets
- Introduction
- Creating Recordsets
- Reading Recordsets
- Filtering Recordsets
- Sorting Recordsets by a Single Column
- Populating Menu Components
- Using Recordsets with DataGrids
-
-
Applications
-
Chapter 22 Building a Flash Paint Application
- Planning the Application
- Building the Components
- Assembling the Flash Paint Application
- Using Flash Paint
-
Chapter 23 Creating a Simple Animation in Stages
- Stage One
- Stage Two
- Stage Three
- Stage Four
- Stage Five
- Conclusion
-
Chapter 24 Video Chat/Message Center
- Developing the Application Overview
- Creating the Server-Side Application
- Creating the Calling Client
- Creating the Administrator Client
- Putting It All Together
-
Chapter 25 Image Viewer/Slideshow
- Planning the Application Design
- Beginning the Application
- Creating the Components
- Putting Together the Application
- Wrapping It Up
-
Chapter 26 Creating an MP3 Jukebox
- Creating an Application Overview
- Developing the MP3 Selectors
- Developing the Jukebox Application
- Wrapping It Up
-
Chapter 27 A Personalized My Page Application
- Formulating the Application Overview
- Creating the Framework
- Creating Service Modules
- Putting It All Together
- Extending the Framework
- Wrapping It Up
-
Chapter 28 A Scheduler Program
- Designing the Application Structure
- Making the Components
- Putting the Application Together
- Making the Scheduler Application Available Online
- Using LoadVars and XML
- Wrapping It Up
-
-
Appendix A Unicode Escape Sequences for Latin 1 Characters
-
Colophon
- Title:
- Actionscript Cookbook
- By:
- Joey Lott
- Publisher:
- O'Reilly Media
- Formats:
-
- Safari Books Online
- Print Release:
- July 2003
- Pages:
- 896
- Print ISBN:
- 978-0-596-00490-3
- | ISBN 10:
- 0-596-00490-7
Our look is the result of reader comments, our own experimentation, and feedback from distribution channels. Distinctive covers complement our distinctive approach to technical topics, breathing personality and life into potentially dry subjects. The animal on the cover of ActionScript Cookbook is a crab-eating opossum (Philander opossum). It can be found throughout Mexico, Central America, and South America. The length of the animal can vary, though it is usually between 250 and 350 millimeters. Its prehensile tail often grows to about the same length.
P. opossum is an omnivore. It eats insects, lizards, eggs, worms, frogs, small mammals, and birds, along with seeds, bananas, and leaves. It reproduces all year round, though the number of offspring varies. During the dry summer months when food is scarce, the litters can be as low as one or two young, while as many as seven young can be born during the more plentiful rainy season.
Most opossum nests are built in the low branches of trees, though they can also be found on the ground or in burrows. P. opossum spends most of its time on the forest floor, where it forages for food, though it will occasionally take to the trees. It was once thought that P. opossum was nocturnal, but it has often been observed scampering and foraging during the day. When it senses danger, P. opossum will hiss or yelp, and it can be a capable fighter. Matt Hutchinson was the production editor and copyeditor for the ActionScript Cookbook. Reg Aubry, Sarah Sherman, and Claire Cloutier provided quality control. Johnna Dinse wrote the index.
Emma Colby designed the cover of this book, based on a series design by Edie Freedman. The cover image is a 19th-century engraving from Cuvier's Animals. Emma Colby produced the cover layout with QuarkXPress 4.1 using Adobe's ITC Garamond font.
David Futato designed the interior layout. This book was converted by Andrew Savikas to FrameMaker 5.5.6 with a format conversion tool created by Erik Ray, Jason McIntosh, Neil Walls, and Mike Sierra that uses Perl and XML technologies. The text font is Linotype Birka; the heading font is Adobe Myriad Condensed; and the code font is LucasFont's TheSans Mono Condensed. The illustrations that appear in the book were produced by Robert Romano and Jessamyn Read using Macromedia FreeHand 9 and Adobe Photoshop 6. The tip and warning icons were drawn by Christopher Bing. This colophon was written by Matt Hutchinson.
