Amazing Books
Temporary Blank

Monday, September 20, 2010

ActionScript Cookbook

ActionScript Cookbook
By Joey Lott

Publisher : O'Reilly
Pub Date : July 2003
ISBN : 0-596-00490-7
Pages : 896

ActionScript's sheer volume of capabilities can be daunting. The ActionScript Cookbook breaks it all down into tasks that are relevant, practical, and insightful. On top of hundreds of atomic recipes, it offers seven full chapters of larger sample applications. Appealing to all levels of ActionScript coders, this book offers concrete solutions to the most common ActionScript needs and problems. The ActionScript Cookbook is for people who want to hit the ground running.

What's Not in This Book
Flash Naming Conventions
The Code
Typographical Conventions
We'd Like to Hear from You

Part I: Local Recipes
Chapter 1. ActionScript Basics
Recipe 1.1. Using Mathematical Operators
Recipe 1.2. Checking Equality or Comparing Values
Recipe 1.3. Performing Actions Conditionally
Recipe 1.4. Performing Complex Conditional Testing
Recipe 1.5. Repeating an Operation Many Times
Recipe 1.6. Performing an Action Once per Frame Update
Recipe 1.7. Repeating a Task at Timed Intervals
Recipe 1.8. Creating Reusable Code
Recipe 1.9. Generalizing a Function to Enhance Reusability
Recipe 1.10. Exiting a Function
Recipe 1.11. Obtaining the Result of a Function
Recipe 1.12. Avoiding Conflicting Variables
Recipe 1.13. Reusing and Organizing Code in Multiple Movies

Chapter 2. Runtime Environment
Recipe 2.1. Detecting the Player Version
Recipe 2.2. Detecting the Operating System
Recipe 2.3. Checking the System Language
Recipe 2.4. Detecting Display Settings
Recipe 2.5. Scaling the Movie
Recipe 2.6. Changing the Alignment
Recipe 2.7. Detecting the Device's Audio Capabilities
Recipe 2.8. Prompting the User to Change Player Settings
Recipe 2.9. Hiding the Flash Player's Menu Items
Recipe 2.10. Enhancing Standalone Projectors
Recipe 2.11. Setting the Dimensions of a Projector
Recipe 2.12. Specifying Where on Screen a Projector Opens

Chapter 3. Color
Recipe 3.1. Setting the Color of a Movie Clip
Recipe 3.2. Specifying RGB Values
Recipe 3.3. Decoding an RGB Value
Recipe 3.4. Setting the RGB Relative to Its Current Value
Recipe 3.5. Tinting a Movie Clip's Color
Recipe 3.6. Setting a Movie Clip's Transparency
Recipe 3.7. Transforming a Movie Clip's Current Color
Recipe 3.8. Restoring a Movie Clip's Original Color
Recipe 3.9. Controlling a Movie Clip's Color with Sliders

Chapter 4. Drawing and Masking
Recipe 4.1. Drawing a Line
Recipe 4.2. Drawing a Curve
Recipe 4.3. Drawing a Rectangle
Recipe 4.4. Drawing a Rounded Rectangle
Recipe 4.5. Drawing a Circle
Recipe 4.6. Drawing an Ellipse
Recipe 4.7. Drawing a Triangle
Recipe 4.8. Drawing Regular Polygons
Recipe 4.9. Filling a Shape with a Solid or Translucent Color
Recipe 4.10. Filling a Shape with a Gradient
Recipe 4.11. Filling a Shape with a Complex Gradient
Recipe 4.12. Scripting Masks

Chapter 5. Numbers and Math
Recipe 5.1. Representing Numbers in Different Bases
Recipe 5.2. Converting Between Different Number Systems
Recipe 5.3. Rounding Numbers
Recipe 5.4. Inserting Leading or Trailing Zeros
Recipe 5.5. Formatting Numbers for Display
Recipe 5.6. Formatting Currency Amounts
Recipe 5.7. Generating a Random Number
Recipe 5.8. Simulating a Coin Flip
Recipe 5.9. Simulating Dice
Recipe 5.10. Simulating Playing Cards
Recipe 5.11. Generating a Unique Number
Recipe 5.12. Converting Angle Measurements
Recipe 5.13. Calculating the Distance Between Two Points
Recipe 5.14. Determining Points Along a Circle
Recipe 5.15. Converting Between Units of Measurement
Recipe 5.16. Calculating Asset Appreciation (Future Value)
Recipe 5.17. Calculating Retirement Savings
Recipe 5.18. Calculating the Loan (Mortgage) You Can Afford
Recipe 5.19. Calculating Loan Amortization or Annuities
Chapter 6. Arrays
Recipe 6.1. Adding Elements to the Start or End of an Array
Recipe 6.2. Looping Through an Array
Recipe 6.3. Searching for Matching Elements in an Array
Recipe 6.4. Removing Elements
Recipe 6.5. Inserting Elements in the Middle of an Array
Recipe 6.6. Converting a String to an Array
Recipe 6.7. Converting an Array to a String
Recipe 6.8. Creating a Separate Copy of an Array
Recipe 6.9. Storing Complex or Multidimensional Data
Recipe 6.10. Sorting or Reversing an Array
Recipe 6.11. Implementing a Custom Sort
Recipe 6.12. Creating an Associative Array
Recipe 6.13. Reading Elements of an Associative Array

Chapter 7. Movie Clips
Recipe 7.1. Referring to Movie Clips via ActionScript
Recipe 7.2. Targeting Movie Clips with Dynamic Names
Recipe 7.3. Affecting Playback
Recipe 7.4. Reversing Playback
Recipe 7.5. Using Movie Clips as Buttons
Recipe 7.6. Defining Hit Areas for Movie Clips
Recipe 7.7. Checking for Mouseover
Recipe 7.8. Performing Repeated Actions on Movie Clips
Recipe 7.9. Fading a Movie Clip
Recipe 7.10. Discovering Nested Movie Clips
Recipe 7.11. Getting Unique Depths
Recipe 7.12. Getting a Movie Clip's Boundaries
Recipe 7.13. Creating a Draggable Movie Clip
Recipe 7.14. Creating a Custom Mouse Pointer
Recipe 7.15. Checking for Overlapping Movie Clips (Performing Hit Tests)
Recipe 7.16. Changing Stacking Order
Recipe 7.17. Converting Between Coordinate Spaces
Recipe 7.18. Duplicating Movie Clips
Recipe 7.19. Adding Movie Clips from the Library with ActionScript

Chapter 8. Text
Recipe 8.1. Referring to a Text Field via ActionScript
Recipe 8.2. Creating a Text Field
Recipe 8.3. Creating an Outline Around a Text Field
Recipe 8.4. Creating a Background for a Text Field
Recipe 8.5. Making a User Input Field
Recipe 8.6. Making a Password Input Field
Recipe 8.7. Filtering Text Input
Recipe 8.8. Restricting the Maximum Field Length
Recipe 8.9. Displaying Dynamic Text at Runtime
Recipe 8.10. Displaying HTML-Formatted Text
Recipe 8.11. Condensing Whitespace
Recipe 8.12. Sizing Text Fields to Fit Contents
Recipe 8.13. Scrolling Text with the ScrollBar Component
Recipe 8.14. Scrolling Text Programmatically
Recipe 8.15. Responding to Scroll Events
Recipe 8.16. Formatting Existing Text
Recipe 8.17. Formatting User-Input Text
Recipe 8.18. Formatting a Portion of a Text Field
Recipe 8.19. Setting a Text Field's Font
Recipe 8.20. Embedding Fonts
Recipe 8.21. Creating Text That Can Be Rotated
Recipe 8.22. Displaying Unicode Text
Recipe 8.23. Assigning Focus to a Text Field
Recipe 8.24. Selecting Text with ActionScript
Recipe 8.25. Setting the Insertion Point in a Text Field
Recipe 8.26. Responding When Text Is Selected or Deselected
Recipe 8.27. Responding to User Text Entry
Recipe 8.28. Adding a Hyperlink to Text

Chapter 9. Strings
Recipe 9.1. Joining Strings
Recipe 9.2. Using Quotes and Apostrophes in Strings
Recipe 9.3. Inserting Special Whitespace Characters
Recipe 9.4. Searching for a Substring
Recipe 9.5. Extracting a Substring
Recipe 9.6. Matching Patterns with Regular Expressions
Recipe 9.7. Looking for a Pattern Match
Recipe 9.8. Parsing a String into Words
Recipe 9.9. Removing and Replacing Characters
Recipe 9.10. Processing One Character at a Time
Recipe 9.11. Converting Case
Recipe 9.12. Trimming Whitespace
Recipe 9.13. Reversing a String by Word or by Letter
Recipe 9.14. Converting Between Strings and Unicode or ASCII

Chapter 10. Dates and Times
Recipe 10.1. Finding the Current Date and Time
Recipe 10.2. Retrieving the Day or Month Name
Recipe 10.3. Formatting the Date and Time
Recipe 10.4. Formatting Milliseconds as Minutes and Seconds
Recipe 10.5. Converting Between DMYHMSM and Epoch Milliseconds
Recipe 10.6. Calculating Elapsed Time or Intervals Between Dates
Recipe 10.7. Parsing a Date from a String
Recipe 10.8. Creating Timers and Clocks

Chapter 11. Forms
Recipe 11.1. Adding UI Components at Runtime
Recipe 11.2. Positioning Form Elements
Recipe 11.3. Adding Menus to a Form
Recipe 11.4. Making Dependent Menus
Recipe 11.5. Resizing Menus to Fit Their Contents
Recipe 11.6. Detecting the Selected Menu Items
Recipe 11.7. Adding Radio Buttons to a Group
Recipe 11.8. Aligning Radio Buttons Automatically
Recipe 11.9. Getting the Selected Radio Button Value
Recipe 11.10. Adding Checkboxes to a Form
Recipe 11.11. Getting Checkbox Values
Recipe 11.12. Assembling an Advanced Form
Recipe 11.13. Submitting a Form
Recipe 11.14. Validating Form Input
Recipe 11.15. Alerting Users to Validation Errors
Recipe 11.16. Making a Multipage Form
Recipe 11.17. Submitting a Multipage Form
Recipe 11.18. Validating a Multipage Form
Recipe 11.19. Transmitting Data Securely
Recipe 11.20. Prepopulating a Form
Recipe 11.21. Customizing the Tab Order
Recipe 11.22. Using Tables to Arrange Form Elements
Recipe 11.23. Creating Auto-Complete Text Fields
Recipe 11.24. Customizing a Component's Appearance
Recipe 11.25. Customizing All Components' Appearances

Chapter 12. Objects and Custom Components
Recipe 12.1. Using Methods and Properties of Built-in Objects
Recipe 12.2. Creating an Instance of a Class
Recipe 12.3. Adding Properties to an Object Instance
Recipe 12.4. Adding Custom Methods to an Object Instance
Recipe 12.5. Creating a Custom Class
Recipe 12.6. Creating Smart Getter/Setter Properties
Recipe 12.7. Defining Read-Only Properties
Recipe 12.8. Creating Subclasses
Recipe 12.9. Implementing Subclass Versions of Superclass Methods
Recipe 12.10. Listening for Events
Recipe 12.11. Adding Listeners to Custom Classes
Recipe 12.12. Creating a Component That Subclasses MovieClip
Recipe 12.13. Program: Color Selector Component

Chapter 13. Programming Sound
Recipe 13.1. Creating an Object to Control Sound
Recipe 13.2. Attaching Sounds at Runtime
Recipe 13.3. Playing and Stopping a Sound
Recipe 13.4. Getting Playback Time
Recipe 13.5. Looping a Sound
Recipe 13.6. Setting In and Out Points
Recipe 13.7. Pausing and Resuming a Sound
Recipe 13.8. Performing Actions When a Sound Ends
Recipe 13.9. Queuing Sounds
Recipe 13.10. Adding Sounds to Buttons and UI Components
Recipe 13.11. Setting the Volume of a Sound
Recipe 13.12. Controlling the Panning of a Sound
Recipe 13.13. Creating Advanced Stereo Panning Effects
Recipe 13.14. Fading In a Sound
Recipe 13.15. Fading Out a Sound
Recipe 13.16. Program: A Sound Controller Component

Part II: Remote Recipes
Chapter 14. FlashCom Server
Recipe 14.1. Creating a New FlashCom Application
Recipe 14.2. Connecting to the FlashCom Server
Recipe 14.3. Adding a Video Object at Runtime
Recipe 14.4. Capturing and Displaying Video from a Web Cam
Recipe 14.5. Capturing and Playing Audio from a Microphone
Recipe 14.6. Controlling FlashCom Audio
Recipe 14.7. Subscribing to Audio/Video Content
Recipe 14.8. Creating Playlists
Recipe 14.9. Recording and Publishing Video and Audio
Recipe 14.10. Publishing Live Content
Recipe 14.11. Pausing and Resuming a Net Stream
Recipe 14.12. Fast-Forwarding and Rewinding a Net Stream
Recipe 14.13. Seeking Relative to the Total Stream Length
Recipe 14.14. Implementing Server-Side ActionScript
Recipe 14.15. Tracking Clients Connected to the Application
Recipe 14.16. Invoking Server-Side Functions from the Client Movie
Recipe 14.17. Invoking Client-Side Functions from the Server

Chapter 15. Loading Assets
Recipe 15.1. Loading an External SWF
Recipe 15.2. Loading an External SWF from a Trusting Domain
Recipe 15.3. Loading an External JPEG Image
Recipe 15.4. Loading an External Image (All Formats)
Recipe 15.5. Loading an External MP3 Sound
Recipe 15.6. Loading Remote Content by Proxy
Recipe 15.7. Determining if an Asset Is Loaded
Recipe 15.8. Getting the Percentage of an Asset That Has Loaded
Recipe 15.9. Monitoring Load Progress Using a Progress Bar Component
Recipe 15.10. Monitoring Load Progress Without a Progress Bar Component
Recipe 15.11. Performing Actions When the Asset Is Loaded
Recipe 15.12. Hiding the Graphics and Text for a Progress Bar

Chapter 16. Storing Persistent Information
Recipe 16.1. Storing and Retrieving Locally Persistent Information
Recipe 16.2. Adding Data to a Client-Side Shared Object
Recipe 16.3. Reading Values from a Client-Side Shared Object
Recipe 16.4. Saving a Local Shared Object
Recipe 16.5. Sharing Information Between Movies Within the Same Domain
Recipe 16.6. Storing Persistent Data on the Server
Recipe 16.7. Saving Remote Shared Object Data
Recipe 16.8. Checking for Updates to Remote Shared Objects
Recipe 16.9. Reading Values from a Server-Side Shared Object
Recipe 16.10. Adding Data to a Server-Side Shared Object

Chapter 17. Communicating with Other Movies
Recipe 17.1. Communicating with Other Movieson the Same Computer
Recipe 17.2. Sending Data Using Local Connections
Recipe 17.3. Validating Receipt of Communication Over a Local Connection
Recipe 17.4. Accepting Communications from Other Domains
Recipe 17.5. Communicating Between Movies on Different Computers
Recipe 17.6. Broadcasting Data to Remote Shared Object Clients

Chapter 18. Sending and Loading Variables
Recipe 18.1. Loading Variables from a Text File
Recipe 18.2. Loading Variables from a Server-Side Script
Recipe 18.3. Checking Load Progress
Recipe 18.4. Sending Data to a Server-Side Script
Recipe 18.5. Sending Variables and Handling a Returned Result

Chapter 19. XML
Recipe 19.1. Understanding XML Structure (Reading and Writing XML)
Recipe 19.2. Creating an XML Object
Recipe 19.3. Adding Elements to an XML Object
Recipe 19.4. Adding Text Nodes to an XML Object
Recipe 19.5. Creating an XML Object from an Array
Recipe 19.6. Adding Attributes to an XML Element
Recipe 19.7. Reading Elements in an XML Tree
Recipe 19.8. Finding Elements by Name
Recipe 19.9. Reading Text Nodes and Their Values
Recipe 19.10. Reading an Element's Attributes
Recipe 19.11. Loading XML
Recipe 19.12. Removing Extra Whitespace from XML Objects
Recipe 19.13. Sending XML
Recipe 19.14. Sending XML Data and Receiving a Response
Recipe 19.15. Searching XML
Recipe 19.16. Using XML Data to Initialize a Movie

Chapter 20. Flash Remoting
Recipe 20.1. Establishing a Connection via Flash Remoting
Recipe 20.2. Configuring Flash Remoting for ColdFusion
Recipe 20.3. Configuring Flash Remoting for .NET
Recipe 20.4. Configuring Flash Remoting for J2EE
Recipe 20.5. Configuring Flash Remoting for PHP or Perl
Recipe 20.6. Invoking a Remote Function on a Service
Recipe 20.7. Handling Flash Remoting Results
Recipe 20.8. Distinguishing Among Results from Multiple Calls to a Single Service
Recipe 20.9. Calling ASP.NET Functions from Flash
Recipe 20.10. Calling ColdFusion Functions from Flash
Recipe 20.11. Passing Named Parameters to ColdFusion Component Methods
Recipe 20.12. Passing Complex Parameters to ColdFusion Component Methods
Recipe 20.13. Calling Java or JSP Functions from Flash
Recipe 20.14. Transmitting Custom Datatypes to a Flash Remoting Back End
Recipe 20.15. Receiving Typed Objects with ColdFusion
Recipe 20.16. Receiving Typed Objects with ASP.NET
Recipe 20.17. Receiving Typed Objects with Java
Recipe 20.18. Returning Typed Objects from ColdFusion
Recipe 20.19. Returning Typed Objects from ASP.NET
Recipe 20.20. Returning Typed Objects from Java
Recipe 20.21. Writing Server-Side Functions in ActionScript
Recipe 20.22. Querying a Database with Server-Side ActionScript
Recipe 20.23. Making HTTP Requests with Server-Side ActionScript
Recipe 20.24. Consuming Web Services with Flash Remoting for .NET or ColdFusion

Chapter 21. Recordsets
Recipe 21.1. Creating Recordsets
Recipe 21.2. Reading Recordsets
Recipe 21.3. Filtering Recordsets
Recipe 21.4. Sorting Recordsets by a Single Column
Recipe 21.5. Populating Menu Components
Recipe 21.6. Using Recordsets with DataGrids

Part III: Applications
Chapter 22. Building a Flash Paint Application
Section 22.1. Planning the Application
Section 22.2. Building the Components
Section 22.3. Assembling the Flash Paint Application
Section 22.4. Using Flash Paint

Chapter 23. Creating a Simple Animation in Stages
Section 23.1. Stage One
Section 23.2. Stage Two
Section 23.3. Stage Three
Section 23.4. Stage Four
Section 23.5. Stage Five
Section 23.6. Conclusion

Chapter 24. Video Chat/Message Center
Section 24.1. Developing the Application Overview
Section 24.2. Creating the Server-Side Application
Section 24.3. Creating the Calling Client
Section 24.4. Creating the Administrator Client
Section 24.5. Putting It All Together

Chapter 25. Image Viewer/Slideshow
Section 25.1. Planning the Application Design
Section 25.2. Beginning the Application
Section 25.3. Creating the Components
Section 25.4. Putting Together the Application
Section 25.5. Wrapping It Up

Chapter 26. Creating an MP3 Jukebox
Section 26.1. Creating an Application Overview
Section 26.2. Developing the MP3 Selectors
Section 26.3. Developing the Jukebox Application
Section 26.4. Wrapping It Up

Chapter 27. A Personalized My Page Application
Section 27.1. Formulating the Application Overview
Section 27.2. Creating the Framework
Section 27.3. Creating Service Modules
Section 27.4. Putting It All Together
Section 27.5. Extending the Framework
Section 27.6. Wrapping It Up

Chapter 28. A Scheduler Program
Section 28.1. Designing the Application Structure
Section 28.2. Making the Components
Section 28.3. Putting the Application Together
Section 28.4. Making the Scheduler Application Available Online
Section 28.5. Using LoadVars and XML
Section 28.6. Wrapping It Up

Appendix A. Unicode Escape Sequences for Latin 1 Characters


Another Web Programming Books

No comments:

Post a Comment

Related Posts with Thumbnails

Put Your Ads Here!