You are previewing Actionscript Cookbook.
O'Reilly logo
Actionscript Cookbook

Book Description

When you need to get the job done fast, you'll reach for this practical, nuts-n-bolts toolkit. Rather than focusing on ActionScript in the abstract, this Cookbook puts theory into practice with ready-made answers to common ActionScript problems. Flash MX developers can solve issues quickly, while learning practical techniques for resolving similar dilemmas in the future. ActionScript has blossomed into a large and important language whose sheer volume of capabilities can be daunting. The ActionScript Cookbook breaks it all down into tasks that are relevant, practical, and insightful. Appealing to the budding coder as well as the experienced ActionScript jockeys, this book offers new perspectives and approaches to ActionScript development that will empower all developers. This O'Reilly Cookbook complements ActionScript for Flash MX: The Definitive Guide, 2nd Edition by providing quick solutions to common ActionScript problems. This book trades on our respected "Cookbook" approach, which provides a worked-out script for every problem addressed. You can use these "recipes" to solve an immediate problem, and then explore the issue further in The Definitive Guide when time permits. The ActionScript Cookbook contains over 300 recipes on a myriad of topics. Here's a sampling of what you'll find:

  • Drawing shapes at runtime

  • Controlling movie clips programmatically

  • Accepting user input and manipulating text strings

  • Accessing audio and video via Flash Communications Server

  • Working with Flash Remoting to connect to back end databases

  • Using record sets with data grids

  • And, much, much more in over 20 recipe-laden chapters...

  • Building a Flash Paint Application

  • Creating a Video/Chat Message Server Application

  • Creating an MP3 Jukebox

  • Creating a personalizable MyPage Application

This Cookbook's logical progression from short recipes for small problems to longer, more complex scripts for thornier riddles allows developers to link modular ActionScript pieces together to create rock-solid solutions for Flash applications. If you prefer to see larger applications instead of atomic recipes, this Cookbook has a kicker -- seven full chapters of sample applications including:

The ActionScript Cookbook is for people who say, "I understand everything in theory, but I don't know where to start in practice." This book is all about practice.

Table of Contents

  1. ActionScript Cookbook
    1. Preface
      1. What’s Not in This Book
      2. Flash Naming Conventions
      3. The Code
      4. Typographical Conventions
      5. We’d Like to Hear from You
      6. Acknowledgments
    2. I. Local Recipes
      1. 1. ActionScript Basics
        1. Introduction
        2. 1.1. Using Mathematical Operators
          1. Problem
          2. Solution
          3. Discussion
        3. 1.2. Checking Equality or Comparing Values
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        4. 1.3. Performing Actions Conditionally
          1. Problem
          2. Solution
          3. Discussion
        5. 1.4. Performing Complex Conditional Testing
          1. Problem
          2. Solution
          3. Discussion
        6. 1.5. Repeating an Operation Many Times
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        7. 1.6. Performing an Action Once per Frame Update
          1. Problem
          2. Solution
          3. Discussion
        8. 1.7. Repeating a Task at Timed Intervals
          1. Problem
          2. Solution
          3. Discussion
        9. 1.8. Creating Reusable Code
          1. Problem
          2. Solution
          3. Discussion
        10. 1.9. Generalizing a Function to Enhance Reusability
          1. Problem
          2. Solution
          3. Discussion
        11. 1.10. Exiting a Function
          1. Problem
          2. Solution
          3. Discussion
        12. 1.11. Obtaining the Result of a Function
          1. Problem
          2. Solution
          3. Discussion
        13. 1.12. Avoiding Conflicting Variables
          1. Problem
          2. Solution
          3. Discussion
        14. 1.13. Reusing and Organizing Code in Multiple Movies
          1. Problem
          2. Solution
          3. Discussion
      2. 2. Runtime Environment
        1. Introduction
        2. 2.1. Detecting the Player Version
          1. Problem
          2. Solution
          3. Discussion
        3. 2.2. Detecting the Operating System
          1. Problem
          2. Solution
          3. Discussion
        4. 2.3. Checking the System Language
          1. Problem
          2. Solution
          3. Discussion
        5. 2.4. Detecting Display Settings
          1. Problem
          2. Solution
          3. Discussion
        6. 2.5. Scaling the Movie
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        7. 2.6. Changing the Alignment
          1. Problem
          2. Solution
          3. Discussion
        8. 2.7. Detecting the Device’s Audio Capabilities
          1. Problem
          2. Solution
          3. Discussion
        9. 2.8. Prompting the User to Change Player Settings
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        10. 2.9. Hiding the Flash Player’s Menu Items
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        11. 2.10. Enhancing Standalone Projectors
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        12. 2.11. Setting the Dimensions of a Projector
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        13. 2.12. Specifying Where on Screen a Projector Opens
          1. Problem
          2. Solution
          3. Discussion
      3. 3. Color
        1. Introduction
        2. 3.1. Setting the Color of a Movie Clip
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        3. 3.2. Specifying RGB Values
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        4. 3.3. Decoding an RGB Value
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        5. 3.4. Setting the RGB Relative to Its Current Value
          1. Problem
          2. Solution
          3. Discussion
        6. 3.5. Tinting a Movie Clip’s Color
          1. Problem
          2. Solution
          3. Discussion
        7. 3.6. Setting a Movie Clip’s Transparency
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        8. 3.7. Transforming a Movie Clip’s Current Color
          1. Problem
          2. Solution
          3. Discussion
        9. 3.8. Restoring a Movie Clip’s Original Color
          1. Problem
          2. Solution
          3. Discussion
        10. 3.9. Controlling a Movie Clip’s Color with Sliders
      4. 4. Drawing and Masking
        1. Introduction
        2. 4.1. Drawing a Line
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        3. 4.2. Drawing a Curve
          1. Problem
          2. Solution
          3. Discussion
        4. 4.3. Drawing a Rectangle
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        5. 4.4. Drawing a Rounded Rectangle
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        6. 4.5. Drawing a Circle
          1. Problem
          2. Solution
          3. Discussion
        7. 4.6. Drawing an Ellipse
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        8. 4.7. Drawing a Triangle
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        9. 4.8. Drawing Regular Polygons
          1. Problem
          2. Solution
          3. Discussion
        10. 4.9. Filling a Shape with a Solid or Translucent Color
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        11. 4.10. Filling a Shape with a Gradient
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        12. 4.11. Filling a Shape with a Complex Gradient
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        13. 4.12. Scripting Masks
          1. Problem
          2. Solution
          3. Discussion
      5. 5. Numbers and Math
        1. Introduction
        2. 5.1. Representing Numbers in Different Bases
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        3. 5.2. Converting Between Different Number Systems
          1. Problem
          2. Solution
          3. Discussion
        4. 5.3. Rounding Numbers
          1. Problem
          2. Solution
          3. Discussion
        5. 5.4. Inserting Leading or Trailing Zeros
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        6. 5.5. Formatting Numbers for Display
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        7. 5.6. Formatting Currency Amounts
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        8. 5.7. Generating a Random Number
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        9. 5.8. Simulating a Coin Flip
          1. Problem
          2. Solution
          3. Discussion
        10. 5.9. Simulating Dice
          1. Problem
          2. Solution
          3. Discussion
        11. 5.10. Simulating Playing Cards
          1. Problem
          2. Solution
          3. Discussion
        12. 5.11. Generating a Unique Number
          1. Problem
          2. Solution
          3. Discussion
        13. 5.12. Converting Angle Measurements
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        14. 5.13. Calculating the Distance Between Two Points
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        15. 5.14. Determining Points Along a Circle
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        16. 5.15. Converting Between Units of Measurement
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        17. 5.16. Calculating Asset Appreciation (Future Value)
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        18. 5.17. Calculating Retirement Savings
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        19. 5.18. Calculating the Loan (Mortgage) You Can Afford
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        20. 5.19. Calculating Loan Amortization or Annuities
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
      6. 6. Arrays
        1. Introduction
        2. 6.1. Adding Elements to the Start or End of an Array
          1. Problem
          2. Solution
          3. Discussion
        3. 6.2. Looping Through an Array
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        4. 6.3. Searching for Matching Elements in an Array
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        5. 6.4. Removing Elements
          1. Problem
          2. Solution
          3. Discussion
        6. 6.5. Inserting Elements in the Middle of an Array
          1. Problem
          2. Solution
          3. Discussion
        7. 6.6. Converting a String to an Array
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        8. 6.7. Converting an Array to a String
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        9. 6.8. Creating a Separate Copy of an Array
          1. Problem
          2. Solution
          3. Discussion
        10. 6.9. Storing Complex or Multidimensional Data
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        11. 6.10. Sorting or Reversing an Array
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        12. 6.11. Implementing a Custom Sort
          1. Problem
          2. Solution
          3. Discussion
        13. 6.12. Creating an Associative Array
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        14. 6.13. Reading Elements of an Associative Array
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
      7. 7. Movie Clips
        1. Introduction
        2. 7.1. Referring to Movie Clips via ActionScript
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        3. 7.2. Targeting Movie Clips with Dynamic Names
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        4. 7.3. Affecting Playback
          1. Problem
          2. Solution
          3. Discussion
        5. 7.4. Reversing Playback
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        6. 7.5. Using Movie Clips as Buttons
          1. Problem
          2. Solution
          3. Discussion
        7. 7.6. Defining Hit Areas for Movie Clips
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        8. 7.7. Checking for Mouseover
          1. Problem
          2. Solution
          3. Discussion
        9. 7.8. Performing Repeated Actions on Movie Clips
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        10. 7.9. Fading a Movie Clip
          1. Problem
          2. Solution
          3. Discussion
        11. 7.10. Discovering Nested Movie Clips
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        12. 7.11. Getting Unique Depths
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        13. 7.12. Getting a Movie Clip’s Boundaries
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        14. 7.13. Creating a Draggable Movie Clip
          1. Problem
          2. Solution
          3. Discussion
        15. 7.14. Creating a Custom Mouse Pointer
          1. Problem
          2. Solution
          3. Discussion
        16. 7.15. Checking for Overlapping Movie Clips (Performing Hit Tests)
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        17. 7.16. Changing Stacking Order
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        18. 7.17. Converting Between Coordinate Spaces
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        19. 7.18. Duplicating Movie Clips
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        20. 7.19. Adding Movie Clips from the Library with ActionScript
          1. Problem
          2. Solution
          3. Discussion
      8. 8. Text
        1. Introduction
        2. 8.1. Referring to a Text Field via ActionScript
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        3. 8.2. Creating a Text Field
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        4. 8.3. Creating an Outline Around a Text Field
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        5. 8.4. Creating a Background for a Text Field
          1. Problem
          2. Solution
          3. Discussion
        6. 8.5. Making a User Input Field
          1. Problem
          2. Solution
          3. Discussion
        7. 8.6. Making a Password Input Field
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        8. 8.7. Filtering Text Input
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        9. 8.8. Restricting the Maximum Field Length
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        10. 8.9. Displaying Dynamic Text at Runtime
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        11. 8.10. Displaying HTML-Formatted Text
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        12. 8.11. Condensing Whitespace
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        13. 8.12. Sizing Text Fields to Fit Contents
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        14. 8.13. Scrolling Text with the ScrollBar Component
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        15. 8.14. Scrolling Text Programmatically
          1. Problem
          2. Solution
          3. Discussion
        16. 8.15. Responding to Scroll Events
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        17. 8.16. Formatting Existing Text
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        18. 8.17. Formatting User-Input Text
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        19. 8.18. Formatting a Portion of a Text Field
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        20. 8.19. Setting a Text Field’s Font
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        21. 8.20. Embedding Fonts
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        22. 8.21. Creating Text That Can Be Rotated
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        23. 8.22. Displaying Unicode Text
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        24. 8.23. Assigning Focus to a Text Field
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        25. 8.24. Selecting Text with ActionScript
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        26. 8.25. Setting the Insertion Point in a Text Field
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        27. 8.26. Responding When Text Is Selected or Deselected
          1. Problem
          2. Solution
          3. Discussion
        28. 8.27. Responding to User Text Entry
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        29. 8.28. Adding a Hyperlink to Text
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
      9. 9. Strings
        1. Introduction
        2. 9.1. Joining Strings
          1. Problem
          2. Solution
          3. Discussion
        3. 9.2. Using Quotes and Apostrophes in Strings
          1. Problem
          2. Solution
          3. Discussion
        4. 9.3. Inserting Special Whitespace Characters
          1. Problem
          2. Solution
          3. Discussion
        5. 9.4. Searching for a Substring
          1. Problem
          2. Solution
          3. Discussion
        6. 9.5. Extracting a Substring
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        7. 9.6. Matching Patterns with Regular Expressions
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        8. 9.7. Looking for a Pattern Match
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        9. 9.8. Parsing a String into Words
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        10. 9.9. Removing and Replacing Characters
          1. Problem
          2. Solution
          3. Discussion
        11. 9.10. Processing One Character at a Time
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        12. 9.11. Converting Case
          1. Problem
          2. Solution
          3. Discussion
        13. 9.12. Trimming Whitespace
          1. Problem
          2. Solution
          3. Discussion
        14. 9.13. Reversing a String by Word or by Letter
          1. Problem
          2. Solution
          3. Discussion
        15. 9.14. Converting Between Strings and Unicode or ASCII
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
      10. 10. Dates and Times
        1. Introduction
        2. 10.1. Finding the Current Date and Time
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        3. 10.2. Retrieving the Day or Month Name
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        4. 10.3. Formatting the Date and Time
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        5. 10.4. Formatting Milliseconds as Minutes and Seconds
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        6. 10.5. Converting Between DMYHMSM and Epoch Milliseconds
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        7. 10.6. Calculating Elapsed Time or Intervals Between Dates
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        8. 10.7. Parsing a Date from a String
          1. Problem
          2. Solution
          3. Discussion
        9. 10.8. Creating Timers and Clocks
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
      11. 11. Forms
        1. Introduction
        2. 11.1. Adding UI Components at Runtime
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        3. 11.2. Positioning Form Elements
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        4. 11.3. Adding Menus to a Form
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        5. 11.4. Making Dependent Menus
          1. Problem
          2. Solution
          3. Discussion
        6. 11.5. Resizing Menus to Fit Their Contents
          1. Problem
          2. Solution
          3. Discussion
        7. 11.6. Detecting the Selected Menu Items
          1. Problem
          2. Solution
          3. Discussion
        8. 11.7. Adding Radio Buttons to a Group
          1. Problem
          2. Solution
          3. Discussion
        9. 11.8. Aligning Radio Buttons Automatically
          1. Problem
          2. Solution
          3. Discussion
        10. 11.9. Getting the Selected Radio Button Value
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        11. 11.10. Adding Checkboxes to a Form
          1. Problem
          2. Solution
          3. Discussion
        12. 11.11. Getting Checkbox Values
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        13. 11.12. Assembling an Advanced Form
          1. Problem
          2. Solution
          3. Discussion
        14. 11.13. Submitting a Form
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        15. 11.14. Validating Form Input
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        16. 11.15. Alerting Users to Validation Errors
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        17. 11.16. Making a Multipage Form
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        18. 11.17. Submitting a Multipage Form
          1. Problem
          2. Solution
          3. Discussion
        19. 11.18. Validating a Multipage Form
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        20. 11.19. Transmitting Data Securely
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        21. 11.20. Prepopulating a Form
          1. Problem
          2. Solution
          3. Discussion
        22. 11.21. Customizing the Tab Order
          1. Problem
          2. Solution
          3. Discussion
        23. 11.22. Using Tables to Arrange Form Elements
          1. Problem
          2. Solution
          3. Discussion
        24. 11.23. Creating Auto-Complete Text Fields
          1. Problem
          2. Solution
          3. Discussion
        25. 11.24. Customizing a Component’s Appearance
          1. Problem
          2. Solution
          3. Discussion
        26. 11.25. Customizing All Components’ Appearances
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
      12. 12. Objects and Custom Components
        1. Introduction
          1. See Also
        2. 12.1. Using Methods and Properties of Built-in Objects
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        3. 12.2. Creating an Instance of a Class
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        4. 12.3. Adding Properties to an Object Instance
          1. Problem
          2. Solution
          3. Discussion
        5. 12.4. Adding Custom Methods to an Object Instance
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        6. 12.5. Creating a Custom Class
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        7. 12.6. Creating Smart Getter/Setter Properties
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        8. 12.7. Defining Read-Only Properties
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        9. 12.8. Creating Subclasses
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        10. 12.9. Implementing Subclass Versions of Superclass Methods
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        11. 12.10. Listening for Events
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        12. 12.11. Adding Listeners to Custom Classes
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        13. 12.12. Creating a Component That Subclasses MovieClip
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        14. 12.13. Program: Color Selector Component
      13. 13. Programming Sound
        1. Introduction
          1. See Also
        2. 13.1. Creating an Object to Control Sound
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        3. 13.2. Attaching Sounds at Runtime
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        4. 13.3. Playing and Stopping a Sound
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        5. 13.4. Getting Playback Time
          1. Problem
          2. Solution
          3. Discussion
        6. 13.5. Looping a Sound
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        7. 13.6. Setting In and Out Points
          1. Problem
          2. Solution
          3. Discussion
        8. 13.7. Pausing and Resuming a Sound
          1. Problem
          2. Solution
          3. Discussion
        9. 13.8. Performing Actions When a Sound Ends
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        10. 13.9. Queuing Sounds
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        11. 13.10. Adding Sounds to Buttons and UI Components
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        12. 13.11. Setting the Volume of a Sound
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        13. 13.12. Controlling the Panning of a Sound
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        14. 13.13. Creating Advanced Stereo Panning Effects
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        15. 13.14. Fading In a Sound
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        16. 13.15. Fading Out a Sound
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        17. 13.16. Program: A Sound Controller Component
          1. See Also
    3. II. Remote Recipes
      1. 14. FlashCom Server
        1. Introduction
        2. 14.1. Creating a New FlashCom Application
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        3. 14.2. Connecting to the FlashCom Server
          1. Problem
          2. Solution
          3. Discussion
        4. 14.3. Adding a Video Object at Runtime
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        5. 14.4. Capturing and Displaying Video from a Web Cam
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        6. 14.5. Capturing and Playing Audio from a Microphone
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        7. 14.6. Controlling FlashCom Audio
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        8. 14.7. Subscribing to Audio/Video Content
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        9. 14.8. Creating Playlists
          1. Problem
          2. Solution
          3. Discussion
        10. 14.9. Recording and Publishing Video and Audio
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        11. 14.10. Publishing Live Content
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        12. 14.11. Pausing and Resuming a Net Stream
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        13. 14.12. Fast-Forwarding and Rewinding a Net Stream
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        14. 14.13. Seeking Relative to the Total Stream Length
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        15. 14.14. Implementing Server-Side ActionScript
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        16. 14.15. Tracking Clients Connected to the Application
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        17. 14.16. Invoking Server-Side Functions from the Client Movie
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        18. 14.17. Invoking Client-Side Functions from the Server
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
      2. 15. Loading Assets
        1. Introduction
        2. 15.1. Loading an External SWF
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        3. 15.2. Loading an External SWF from a Trusting Domain
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        4. 15.3. Loading an External JPEG Image
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        5. 15.4. Loading an External Image (All Formats)
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        6. 15.5. Loading an External MP3 Sound
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        7. 15.6. Loading Remote Content by Proxy
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        8. 15.7. Determining if an Asset Is Loaded
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        9. 15.8. Getting the Percentage of an Asset That Has Loaded
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        10. 15.9. Monitoring Load Progress Using a Progress Bar Component
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        11. 15.10. Monitoring Load Progress Without a Progress Bar Component
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        12. 15.11. Performing Actions When the Asset Is Loaded
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        13. 15.12. Hiding the Graphics and Text for a Progress Bar
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
      3. 16. Storing Persistent Information
        1. Introduction
        2. 16.1. Storing and Retrieving Locally Persistent Information
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        3. 16.2. Adding Data to a Client-Side Shared Object
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        4. 16.3. Reading Values from a Client-Side Shared Object
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        5. 16.4. Saving a Local Shared Object
          1. Problem
          2. Solution
          3. Discussion
        6. 16.5. Sharing Information Between Movies Within the Same Domain
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        7. 16.6. Storing Persistent Data on the Server
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        8. 16.7. Saving Remote Shared Object Data
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        9. 16.8. Checking for Updates to Remote Shared Objects
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        10. 16.9. Reading Values from a Server-Side Shared Object
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        11. 16.10. Adding Data to a Server-Side Shared Object
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
      4. 17. Communicating with Other Movies
        1. Introduction
          1. See Also
        2. 17.1. Communicating with Other Movieson the Same Computer
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        3. 17.2. Sending Data Using Local Connections
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        4. 17.3. Validating Receipt of Communication Over a Local Connection
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        5. 17.4. Accepting Communications from Other Domains
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        6. 17.5. Communicating Between Movies on Different Computers
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        7. 17.6. Broadcasting Data to Remote Shared Object Clients
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
      5. 18. Sending and Loading Variables
        1. Introduction
        2. 18.1. Loading Variables from a Text File
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        3. 18.2. Loading Variables from a Server-Side Script
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        4. 18.3. Checking Load Progress
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        5. 18.4. Sending Data to a Server-Side Script
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        6. 18.5. Sending Variables and Handling a Returned Result
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
      6. 19. XML
        1. Introduction
        2. 19.1. Understanding XML Structure (Reading and Writing XML)
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        3. 19.2. Creating an XML Object
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        4. 19.3. Adding Elements to an XML Object
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        5. 19.4. Adding Text Nodes to an XML Object
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        6. 19.5. Creating an XML Object from an Array
          1. Problem
          2. Solution
          3. Discussion
        7. 19.6. Adding Attributes to an XML Element
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        8. 19.7. Reading Elements in an XML Tree
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        9. 19.8. Finding Elements by Name
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        10. 19.9. Reading Text Nodes and Their Values
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        11. 19.10. Reading an Element’s Attributes
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        12. 19.11. Loading XML
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        13. 19.12. Removing Extra Whitespace from XML Objects
          1. Problem
          2. Solution
          3. Discussion
        14. 19.13. Sending XML
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        15. 19.14. Sending XML Data and Receiving a Response
          1. Problem
          2. Solution
          3. Discussion
        16. 19.15. Searching XML
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        17. 19.16. Using XML Data to Initialize a Movie
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
      7. 20. Flash Remoting
        1. Introduction
        2. 20.1. Establishing a Connection via Flash Remoting
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        3. 20.2. Configuring Flash Remoting for ColdFusion
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        4. 20.3. Configuring Flash Remoting for .NET
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        5. 20.4. Configuring Flash Remoting for J2EE
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        6. 20.5. Configuring Flash Remoting for PHP or Perl
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        7. 20.6. Invoking a Remote Function on a Service
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        8. 20.7. Handling Flash Remoting Results
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        9. 20.8. Distinguishing Among Results from Multiple Calls to a Single Service
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        10. 20.9. Calling ASP.NET Functions from Flash
          1. Problem
          2. Solution
          3. Discussion
        11. 20.10. Calling ColdFusion Functions from Flash
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        12. 20.11. Passing Named Parameters to ColdFusion Component Methods
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        13. 20.12. Passing Complex Parameters to ColdFusion Component Methods
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        14. 20.13. Calling Java or JSP Functions from Flash
          1. Problem
          2. Solution
          3. Discussion
        15. 20.14. Transmitting Custom Datatypes to a Flash Remoting Back End
          1. Problem
          2. Solution
          3. Discussion
        16. 20.15. Receiving Typed Objects with ColdFusion
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        17. 20.16. Receiving Typed Objects with ASP.NET
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        18. 20.17. Receiving Typed Objects with Java
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        19. 20.18. Returning Typed Objects from ColdFusion
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        20. 20.19. Returning Typed Objects from ASP.NET
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        21. 20.20. Returning Typed Objects from Java
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        22. 20.21. Writing Server-Side Functions in ActionScript
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        23. 20.22. Querying a Database with Server-Side ActionScript
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        24. 20.23. Making HTTP Requests with Server-Side ActionScript
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        25. 20.24. Consuming Web Services with Flash Remoting for .NET or ColdFusion
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
      8. 21. Recordsets
        1. Introduction
        2. 21.1. Creating Recordsets
          1. Problem
          2. Solution
          3. Discussion
        3. 21.2. Reading Recordsets
          1. Problem
          2. Solution
          3. Discussion
        4. 21.3. Filtering Recordsets
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
        5. 21.4. Sorting Recordsets by a Single Column
          1. Problem
          2. Solution
          3. Discussion
        6. 21.5. Populating Menu Components
          1. Problem
          2. Solution
          3. Discussion
        7. 21.6. Using Recordsets with DataGrids
          1. Problem
          2. Solution
          3. Discussion
          4. See Also
    4. III. Applications
      1. 22. Building a Flash Paint Application
        1. Planning the Application
        2. Building the Components
          1. Creating the Superclass for the Components
          2. Creating the Toolbar Button Component
          3. Creating the Shape Component
          4. Creating the Text Component
          5. Creating the Color Selector Component
        3. Assembling the Flash Paint Application
        4. Using Flash Paint
      2. 23. Creating a Simple Animation in Stages
        1. Stage One
        2. Stage Two
        3. Stage Three
        4. Stage Four
        5. Stage Five
        6. Conclusion
      3. 24. Video Chat/Message Center
        1. Developing the Application Overview
        2. Creating the Server-Side Application
        3. Creating the Calling Client
        4. Creating the Administrator Client
        5. Putting It All Together
      4. 25. Image Viewer/Slideshow
        1. Planning the Application Design
        2. Beginning the Application
        3. Creating the Components
          1. Designing the Image Element
          2. Designing the Image View Pane
          3. Designing the Preview Pane
          4. Designing the Sequence Viewer
          5. Designing the Sequencer Item Component
          6. Designing the Sequencer Component
          7. Designing the Menu Component
        4. Putting Together the Application
        5. Wrapping It Up
      5. 26. Creating an MP3 Jukebox
        1. Creating an Application Overview
        2. Developing the MP3 Selectors
          1. Creating a Local MP3 Selector
            1. Making the Form page
            2. Making the Submit page
            3. Making the local connection Flash movie
          2. Creating the Server MP3 Selector
            1. Making the CFC
            2. Making the server MP3 selector Flash movie
            3. Making the HTML page for the server MP3 selector
            4. Notes on the server MP3 selector
        3. Developing the Jukebox Application
          1. Adding the Sound Controller
          2. Creating the Main Jukebox Movie
        4. Wrapping It Up
      6. 27. A Personalized My Page Application
        1. Formulating the Application Overview
        2. Creating the Framework
          1. Sharing Common Functions
          2. Configuring the Available Modules
          3. Adding a Component
            1. Defining UnitComponentBar
            2. Defining UnitComponent
          4. Setting Up the Framework Form
        3. Creating Service Modules
          1. Making Notes
          2. Keeping Track of Addresses
          3. Searching the Web Using Google
        4. Putting It All Together
        5. Extending the Framework
          1. Making a Server-Side Shared Object
          2. Performing File Operations
          3. Modifying the My Page Framework
          4. Reexamining the Services
        6. Wrapping It Up
      7. 28. A Scheduler Program
        1. Designing the Application Structure
        2. Making the Components
          1. Designing the TimeSelector Component
          2. Designing the TimeSelectorItem Component
          3. Designing the Schedule Component
          4. Designing the ScheduleItem Component
          5. Designing the NotifierDisplayer Component
        3. Putting the Application Together
        4. Making the Scheduler Application Available Online
          1. Using Remote Shared Objects
          2. Using Flash Remoting
        5. Using LoadVars and XML
        6. Wrapping It Up
    5. A. Unicode Escape Sequences for Latin 1 Characters
    6. Index
    7. Colophon