Cover image for Flex 3 Cookbook

Book description

The best way to showcase a powerful new technology is to demonstrate its real-world results, and that's exactly what this new Cookbook does with Adobe Flex 3. Wide ranging and highly practical, Flex 3 Cookbook contains more than 300 proven recipes for developing interactive Rich Internet Applications and Web 2.0 sites. You'll find everything from Flex basics, to solutions for working with visual components and data access, to tips on application development, unit testing, and using Adobe AIR. You also get ideas from the development community. Through its Flex Cookbook website (www.adobe.com/devnet/), Adobe invited Flex developers to post their own solutions for working with this technology, and from hundreds of posts, the authors chose the best and most useful solutions to supplement Flex 3 Cookbook. Each recipe inside provides a solution to a common problem, explains how and why it works, and offers sample code that you can put to use immediately. Topics include:

  • Containers and dialogues

  • Working with Text

  • Data driven components

  • DataGrid and Advanced DataGrid

  • ItemRenderers and Editors

  • Images, bitmaps, videos, and sounds

  • CSS, styling, and skinning

  • States and effects

  • Working with Collections, arrays, and DataProviders

  • Using DataBinding

  • Validation, formatting, and regular expressions

  • Using Charts and data visualization

  • Services and Data Access

  • Using RSLs and Modules

  • Working with Adobe AIR

Whether you're a committed Flex developer or still evaluating the technology, you'll discover how to get quick results with Flex 3 using the recipes in this Cookbook. It's an ideal way to jumpstart your next web application.

Table of Contents

  1. Flex 3 Cookbook
  2. A Note Regarding Supplemental Files
  3. Preface
    1. 1. Bonus Chapters Online
    2. 2. Who This Book Is For
    3. 3. Who This Book Is Not For
    4. 4. How This Book Is Organized
    5. Conventions Used in This Book
    6. Using Code Examples
    7. How to Use This Book
    8. O’Reilly Cookbooks
    9. Safari® Enabled
    10. How to Contact Us
    11. 5. Acknowledgments
      1. From Joshua
      2. From Todd
    12. 6. Author Bios
    13. Contributor Bios
    14. Colophon
  4. 1. Flex and ActionScript Basics
    1. 1.1. Create a Flex Project in Flex Builder
      1. Problem
      2. Solution
      3. Discussion
    2. 1.2. Create a Flex Library Project in Flex Builder
      1. Problem
      2. Solution
      3. Discussion
    3. 1.3. Create an ActionScript Project
      1. Problem
      2. Solution
      3. Discussion
    4. 1.4. Set Compiler Options for the MXML Compiler in Flex Builder
      1. Problem
      2. Solution
      3. Discussion
    5. 1.5. Compile a Flex Project Outside of Flex Builder
      1. Problem
      2. Solution
      3. Discussion
    6. 1.6. Add an Event Listener in MXML
      1. Problem
      2. Solution
      3. Discussion
    7. 1.7. Set Properties of a Child Defined in MXML in ActionScript
      1. Problem
      2. Solution
      3. Discussion
    8. 1.8. Define Arrays and Objects
      1. Problem
      2. Solution
      3. Discussion
    9. 1.9. Set the Scope of Variables in ActionScript
      1. Problem
      2. Solution
      3. Discussion
    10. 1.10. Create a Component in ActionScript
      1. Problem
      2. Solution
      3. Discussion
    11. 1.11. Use Event Bubbling
      1. Problem
      2. Solution
      3. Discussion
    12. 1.12. Use a Code-Behind Model to Separate MXML and ActionScript
      1. Problem
      2. Solution
      3. Discussion
    13. 1.13. Make Properties of a Component Bindable
      1. Problem
      2. Solution
      3. Discussion
    14. 1.14. Use Custom Events and Dispatch Data with Events
      1. Problem
      2. Solution
      3. Discussion
    15. 1.15. Listen for a Keyboard Event
      1. Problem
      2. Solution
      3. Discussion
    16. 1.16. Define Optional Parameters for Methods
      1. Problem
      2. Solution
      3. Discussion
    17. 1.17. Determine the Type of an Object
      1. Problem
      2. Solution
      3. Discussion
    18. 1.18. Define and Implement an Interface
      1. Problem
      2. Solution
      3. Discussion
  5. 2. Menus and Controls
    1. 2.1. Listen to a Button Click
      1. Problem
      2. Solution
      3. Discussion
    2. 2.2. Create a Set of Buttons That Toggle
      1. Problem
      2. Solution
      3. Discussion
    3. 2.3. Use a ColorPicker to Set Canvas Color
      1. Problem
      2. Solution
      3. Discussion
    4. 2.4. Load a SWF by Using the SWFLoader
      1. Problem
      2. Solution
      3. Discussion
    5. 2.5. Set Tab Indexes for Components
      1. Problem
      2. Solution
      3. Discussion
    6. 2.6. Set a labelFunction for a Control
      1. Problem
      2. Solution
      3. Discussion
    7. 2.7. Provide Data for Menus
      1. Problem
      2. Solution
      3. Discussion
    8. 2.8. Dynamically Populate Menus
      1. Problem
      2. Solution
      3. Discussion
    9. 2.9. Create EventHandlers for Menu-Based Controls
      1. Problem
      2. Solution
      3. Discussion
    10. 2.10. Display an Alert in an Application
      1. Problem
      2. Solution
      3. Discussion
    11. 2.11. Use the Date from a Calendar Control
      1. Problem
      2. Solution
      3. Discussion
    12. 2.12. Display and Position Multiple Pop-ups
      1. Problem
      2. Solution
      3. Discussion
    13. 2.13. Create a Custom Border for a Pop-up Window
      1. Problem
      2. Solution
      3. Discussion
    14. 2.14. Handle focusIn and focusOut Events
      1. Problem
      2. Solution
      3. Discussion
  6. 3. Containers
    1. 3.1. Position Children by Using Layout Management
      1. Problem
      2. Solution
      3. Discussion
    2. 3.2. Position and Size Containers via Percentage Positioning
      1. Problem
      2. Solution
      3. Discussion
    3. 3.3. Track Mouse Position Within Different Coordinate Systems
      1. Problem
      2. Solution
      3. Discussion
    4. 3.4. Dynamically Add and Remove Children from a Container
      1. Problem
      2. Solution
      3. Discussion
    5. 3.5. Use Constraint-Based Layout for Containers
      1. Problem
      2. Solution
      3. Discussion
    6. 3.6. Set Maximum and Minimum Sizes for Children Within Containers
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    7. 3.7. Specify Constraint Rows and Columns for a Container
      1. Problem
      2. Solution
      3. Discussion
    8. 3.8. Create Layout Flows for Text Using Constraints
      1. Problem
      2. Solution
      3. Discussion
    9. 3.9. Control Scrolling and Overflow Within Containers
      1. Problem
      2. Solution
      3. Discussion
    10. 3.10. Control the Layout of Box Components
      1. Problem
      2. Solution
      3. Discussion
    11. 3.11. Use Containers for Initialization
      1. Problem
      2. Solution
      3. Discussion
    12. 3.12. Create a TitleWindow
      1. Problem
      2. Solution
      3. Discussion
    13. 3.13. Control a ViewStack via a LinkBar
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    14. 3.14. Bind the Selected Index of a ViewStack to a Variable
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    15. 3.15. Use Delayed Instantiation to Improve Startup Time
      1. Problem
      2. Solution
      3. Discussion
    16. 3.16. Create and Control Resizable Containers
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    17. 3.17. Create, Enable, and Disable TabControls Within a TabNavigator
      1. Problem
      2. Solution
      3. Discussion
    18. 3.18. Create a TabNavigator with Closeable Tabs
      1. Problem
      2. Solution
      3. Discussion
    19. 3.19. Create and Control an Alert
      1. Problem
      2. Solution
      3. Discussion
    20. 3.20. Size and Position a Dialog Box Based on Its Calling Component
      1. Problem
      2. Solution
      3. Discussion
    21. 3.21. Manage Multiple Pop-up Dialog Boxes
      1. Problem
      2. Solution
      3. Discussion
    22. 3.22. Scroll to a Specific Child in a Container
      1. Problem
      2. Solution
      3. Discussion
    23. 3.23. Create a Template Using IDeferredInstance
      1. Problem
      2. Solution
      3. Discussion
    24. 3.24. Manually Lay Out a Container
      1. Problem
      2. Solution
      3. Discussion
    25. 3.25. Measure and Alter Container Size
      1. Problem
      2. Solution
      3. Discussion
    26. 3.26. Control the Visibility and Layout of Children
      1. Problem
      2. Solution
      3. Discussion
    27. 3.27. Create a Tile Container with Simple Reorganization
      1. Problem
      2. Solution
      3. Discussion
    28. 3.28. Set a Background Image and Rounded Corners in an HBox
      1. Problem
      2. Solution
      3. Discussion
    29. 3.29. Control Positioning and Scrolling of Child Components
      1. Problem
      2. Solution
      3. Discussion
  7. 4. Text
    1. 4.1. Correctly Set the Value of a Text Object
      1. Problem
      2. Solution
      3. Discussion
    2. 4.2. Bind a Value to TextInput
      1. Problem
      2. Solution
      3. Discussion
    3. 4.3. Create a Suggestive TextInput
      1. Problem
      2. Solution
      3. Discussion
    4. 4.4. Create an In-Place Editor
      1. Problem
      2. Solution
      3. Discussion
    5. 4.5. Determine All Fonts Installed on a User’s Computer
      1. Problem
      2. Solution
      3. Discussion
    6. 4.6. Create a Custom TextInput
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    7. 4.7. Set the Style Properties for Text Ranges
      1. Problem
      2. Solution
      3. Discussion
    8. 4.8. Display Images and SWFs in HTML
      1. Problem
      2. Solution
      3. Discussion
    9. 4.9. Highlight User-Input Text in a Search Field
      1. Problem
      2. Solution
      3. Discussion
    10. 4.10. Manipulate Characters as Individual Graphics
      1. Problem
      2. Solution
      3. Discussion
    11. 4.11. Specify Styles for HTML in a TextField
      1. Problem
      2. Solution
      3. Discussion
    12. 4.12. Use the RichTextEditor
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    13. 4.13. Apply Embedded Fonts with HTML
      1. Problem
      2. Solution
      3. Discussion
    14. 4.14. Add a Drop Shadow to Text in a Text Component
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    15. 4.15. Find the Last Displayed Character in a TextArea
      1. Problem
      2. Solution
      3. Discussion
  8. 5. Lists, Tiles, and Trees
    1. 5.1. Create an Editable List
      1. Problem
      2. Solution
      3. Discussion
    2. 5.2. Set Icons for Items in a List
      1. Problem
      2. Solution
      3. Discussion
    3. 5.3. Add Effects to a List to Indicate Changes
      1. Problem
      2. Solution
      3. Discussion
    4. 5.4. Set a Basic Item Renderer for a TileList
      1. Problem
      2. Solution
      3. Discussion
    5. 5.5. Set XML Data for a Tree
      1. Problem
      2. Solution
      3. Discussion
    6. 5.6. Create an Item Renderer for a Tree
      1. Problem
      2. Solution
      3. Discussion
    7. 5.7. Use Complex Data Objects in a Tree Control
      1. Problem
      2. Solution
      3. Discussion
    8. 5.8. Allow Only Certain Items in a List to Be Selectable
      1. Problem
      2. Solution
      3. Discussion
    9. 5.9. Format and Validate Data Added in a List’s Item Editor
      1. Problem
      2. Solution
      3. Discussion
    10. 5.10. Track All Selected Children in a TileList
      1. Problem
      2. Solution
      3. Discussion
    11. 5.11. Use and Display Null Items in an Item Renderer
      1. Problem
      2. Solution
      3. Discussion
    12. 5.12. Create a Right-Click Menu for a List
      1. Problem
      2. Solution
      3. Discussion
    13. 5.13. Customize the Appearance of a Selection in a List
      1. Problem
      2. Solution
      3. Discussion
  9. 6. DataGrid and Advanced DataGrid
    1. 6.1. Create Custom Columns for a DataGrid
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    2. 6.2. Specify Sort Functions for DataGrid Columns
      1. Problem
      2. Solution
      3. Discussion
    3. 6.3. Enable Multicolumn Sorting in a DataGrid
      1. Problem
      2. Solution
      3. Discussion
    4. 6.4. Filter Items in a DataGrid
      1. Problem
      2. Solution
      3. Discussion
    5. 6.5. Create Custom Headers for an AdvancedDataGrid
      1. Problem
      2. Solution
      3. Discussion
    6. 6.6. Handle Events from a DataGrid/AdvancedDataGrid
      1. Problem
      2. Solution
      3. Discussion
    7. 6.7. Select Items in an AdvancedDataGrid
      1. Problem
      2. Solution
      3. Discussion
    8. 6.8. Enable Drag-and-Drop in a DataGrid
      1. Problem
      2. Solution
      3. Discussion
    9. 6.9. Edit Items in a DataGrid
      1. Problem
      2. Solution
      3. Discussion
    10. 6.10. Search Within a DataGrid and Autoscroll to the Match
      1. Problem
      2. Solution
      3. Discussion
    11. 6.11. Generate a Summary for Flat Data by Using GroupingCollection
      1. Problem
      2. Solution
      3. Discussion
    12. 6.12. Create an Async Refresh for a GroupingCollection
      1. Problem
      2. Solution
      3. Discussion
  10. 7. Renderers and Editors
    1. 7.1. Create Your Own Renderers
      1. Problem
      2. Solution
      3. Discussion
    2. 7.2. Use the ClassFactory to Generate Renderers
      1. Problem
      2. Solution
      3. Discussion
    3. 7.3. Access the Component That Owns a Renderer
      1. Problem
      2. Solution
      3. Discussion
    4. 7.4. Create a Single Component to Act as Renderer and Editor
      1. Problem
      2. Solution
      3. Discussion
    5. 7.5. Create an Item Editor to Handle Data with Multiple Fields
      1. Problem
      2. Solution
      3. Discussion
    6. 7.6. Display SWF Objects as Items in a Menu by Using an Item Renderer
      1. Problem
      2. Solution
      3. Discussion
    7. 7.7. Select a DataGrid Column with a CheckBox Header Renderer
      1. Problem
      2. Solution
      3. Discussion
    8. 7.8. Create a Self-Contained CheckBox itemRenderer for Use in a DataGrid
      1. Problem
      2. Solution
      3. Discussion
    9. 7.9. Efficiently Set Images in a Renderer
      1. Problem
      2. Solution
      3. Discussion
    10. 7.10. Use Runtime Styling with itemRenderers and itemEditors
      1. Problem
      2. Solution
      3. Discussion
    11. 7.11. Use States and Transitions with an itemEditor
      1. Problem
      2. Solution
      3. Discussion
    12. 7.12. Create a CheckBox Tree Control
      1. Problem
      2. Solution
      3. Discussion
    13. 7.13. Resize Renderers Within a List
      1. Problem
      2. Solution
      3. Discussion
  11. 8. Images, Bitmaps, Videos, Sounds
    1. 8.1. Load and Display an Image
      1. Problem
      2. Solution
      3. Discussion
    2. 8.2. Create a Video Display
      1. Problem
      2. Solution
      3. Discussion
    3. 8.3. Play and Pause an MP3 File
      1. Problem
      2. Solution
      3. Discussion
    4. 8.4. Create a Seek Bar for a Sound File
      1. Problem
      2. Solution
      3. Discussion
    5. 8.5. Blend Two Images
      1. Problem
      2. Solution
      3. Discussion
    6. 8.6. Apply a Convolution Filter to an Image
      1. Problem
      2. Solution
      3. Discussion
    7. 8.7. Send Video to an FMS Instance via a Camera
      1. Problem
      2. Solution
      3. Discussion
    8. 8.8. Access a User’s Microphone and Create a Sound Display
      1. Problem
      2. Solution
      3. Discussion
    9. 8.9. Smooth Video Displayed in a Flex Application
      1. Problem
      2. Solution
      3. Discussion
    10. 8.10. Check Pixel-Level Collisions
      1. Problem
      2. Solution
      3. Discussion
    11. 8.11. Read and Save a User’s Webcam Image
      1. Problem
      2. Solution
      3. Discussion
    12. 8.12. Use Blend Modes with Multiple Images
      1. Problem
      2. Solution
      3. Discussion
    13. 8.13. Handle Cue Points in FLV Data
      1. Problem
      2. Solution
      3. Discussion
    14. 8.14. Create a Video Scrubber
      1. Problem
      2. Solution
      3. Discussion
    15. 8.15. Read ID3 Data from an MP3 File
      1. Problem
      2. Solution
      3. Discussion
    16. 8.16. Display a Custom Loader while Loading Images
      1. Problem
      2. Solution
      3. Discussion
    17. 8.17. Enable Image Upload in Flex
      1. Problem
      2. Solution
      3. Discussion
    18. 8.18. Compare Two Bitmap Images
      1. Problem
      2. Solution
      3. Discussion
  12. 9. Skinning and Styling
    1. 9.1. Use CSS to Style Components
      1. Problem
      2. Solution
      3. Discussion
    2. 9.2. Override the Default Application Style
      1. Problem
      2. Solution
      3. Discussion
    3. 9.3. Embed Styles by Using CSS
      1. Problem
      2. Solution
      3. Discussion
    4. 9.4. Override Base Style Properties
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    5. 9.5. Customize Styles at Runtime
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    6. 9.6. Load CSS at Runtime
      1. Problem
      2. Solution
      3. Discussion
    7. 9.7. Declare Styles at Runtime
      1. Problem
      2. Solution
      3. Discussion
    8. 9.8. Create Custom Style Properties for Components
      1. Problem
      2. Solution
      3. Discussion
    9. 9.9. Use Multiple Themes in the Same Application
      1. Problem
      2. Solution
      3. Discussion
    10. 9.10. Compile a Theme SWC
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    11. 9.11. Use Embedded Fonts
      1. Problem
      2. Solution
      3. Discussion
    12. 9.12. Embed Fonts from a SWF File
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    13. 9.13. Skin with Embedded Images
      1. Problem
      2. Solution
      3. Discussion
    14. 9.14. Apply Skins from a SWF File
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    15. 9.15. Programmatically Skin a Component
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    16. 9.16. Programmatically Skin a Stateful Control
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    17. 9.17. Create Animated Skins from a SWF File
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    18. 9.18. Customize the Preloader
      1. Problem
      2. Solution
      3. Discussion
  13. 10. Dragging and Dropping
    1. 10.1. Use the DragManager Class
      1. Problem
      2. Solution
      3. Discussion
    2. 10.2. Specify a Drag Proxy
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    3. 10.3. Drag and Drop Within a List
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    4. 10.4. Drag and Drop Between Lists
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    5. 10.5. Enable and Disable Drag Operations
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    6. 10.6. Customize the DragImage of a List-Based Control
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    7. 10.7. Customize the Drop Indicator of a List-Based Control
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
  14. 11. States
    1. 11.1. Set Styles and Properties in a State
      1. Problem
      2. Solution
      3. Discussion
    2. 11.2. Create Transitions to Enter and Leave States
      1. Problem
      2. Solution
      3. Discussion
    3. 11.3. Use the AddChildAction and RemoveChildAction
      1. Problem
      2. Solution
      3. Discussion
    4. 11.4. Filter Transitions to Affect Only Certain Types of Children
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    5. 11.5. Apply Parts of a Transition to Certain Children
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    6. 11.6. Base a State on Another State
      1. Problem
      2. Solution
      3. Discussion
    7. 11.7. Integrate View States with HistoryManagement
      1. Problem
      2. Solution
      3. Discussion
    8. 11.8. Use Deferred Instance Factories with States
      1. Problem
      2. Solution
      3. Discussion
    9. 11.9. Use Data Binding with Objects Added in a State
      1. Problem
      2. Solution
      3. Discussion
    10. 11.10. Add and Remove Event Listeners in State Changes
      1. Problem
      2. Solution
      3. Discussion
    11. 11.11. Add View States to a Flash Component
      1. Problem
      2. Solution
      3. Discussion
    12. 11.12. Work with State Change Events
      1. Problem
      2. Solution
      3. Discussion
    13. 11.13. Dynamically Generate and Use New States and Transitions
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    14. 11.14. Create Custom Actions to Use in a State
      1. Problem
      2. Solution
      3. Discussion
  15. 12. Effects
    1. 12.1. Call an Effect in MXML and in ActionScript
      1. Problem
      2. Solution
      3. Discussion
    2. 12.2. Build a Custom Effect
      1. Problem
      2. Solution
      3. Discussion
    3. 12.3. Create Parallel Series or Sequences of Effects
      1. Problem
      2. Solution
      3. Discussion
    4. 12.4. Pause, Reverse, and Restart an Effect
      1. Problem
      2. Solution
      3. Discussion
    5. 12.5. Create Custom Effect Triggers
      1. Problem
      2. Solution
      3. Discussion
    6. 12.6. Create Tween Effects
      1. Problem
      2. Solution
      3. Discussion
    7. 12.7. Use the DisplacementMapFilter Filter in a Flex Effect
      1. Problem
      2. Solution
      3. Discussion
    8. 12.8. Create an AnimateColor Effect
      1. Problem
      2. Solution
      3. Discussion
    9. 12.9. Use the Convolution Filter to Create a Tween
      1. Problem
      2. Solution
      3. Discussion
  16. 13. Collections
    1. 13.1. Add, Sort, and Retrieve Data from an ArrayCollection
      1. Problem
      2. Solution
      3. Discussion
    2. 13.2. Filter an ArrayCollection
      1. Problem
      2. Solution
      3. Discussion
    3. 13.3. Determine When an Item Is Modified in an ArrayCollection
      1. Problem
      2. Solution
      3. Discussion
    4. 13.4. Create a GroupingCollection
      1. Problem
      2. Solution
      3. Discussion
    5. 13.5. Create a Hierarchical Data Provider for a Control
      1. Problem
      2. Solution
      3. Discussion
    6. 13.6. Navigate a Collection Object and Save Your Position
      1. Problem
      2. Solution
      3. Discussion
    7. 13.7. Create a HierarchicalViewCollection Object
      1. Problem
      2. Solution
      3. Discussion
    8. 13.8. Filter and Sort an XMLListCollection
      1. Problem
      2. Solution
      3. Discussion
    9. 13.9. Sort on Multiple Fields in a Collection
      1. Problem
      2. Solution
      3. Discussion
    10. 13.10. Sort on Dates in a Collection
      1. Problem
      2. Solution
      3. Discussion
    11. 13.11. Create a Deep Copy of an ArrayCollection
      1. Problem
      2. Solution
      3. Discussion
    12. 13.12. Use Data Objects with Unique IDs
      1. Problem
      2. Solution
      3. Discussion
  17. 14. Data Binding
    1. 14.1. Bind to a Property
      1. Problem
      2. Solution
      3. Discussion
    2. 14.2. Bind to a Function
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    3. 14.3. Create a Bidirectional Binding
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    4. 14.4. Bind to Properties by Using ActionScript
      1. Problem
      2. Solution
      3. Discussion
    5. 14.5. Use Bindable Property Chains
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    6. 14.6. Bind to Properties on XML by Using E4X
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    7. 14.7. Create Customized Bindable Properties
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    8. 14.8. Bind to a Generic Object
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    9. 14.9. Bind to Properties on a Dynamic Class
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
  18. 15. Validation, Formatting, and Regular Expressions
    1. 15.1. Use Validators and Formatters with TextInput and TextArea Controls
      1. Problem
      2. Solution
      3. Discussion
    2. 15.2. Create a Custom Formatter
      1. Problem
      2. Solution
      3. Discussion
    3. 15.3. Create a More-International Zip Code Validator by Using Regular Expressions
      1. Problem
      2. Solution
      3. Discussion
    4. 15.4. Create a Validator to Validate UPCs
      1. Problem
      2. Solution
      3. Discussion
    5. 15.5. Validate Combo Boxes and Groups of Radio Buttons
      1. Problem
      2. Solution
      3. Discussion
    6. 15.6. Show Validation Errors by Using ToolTips in a Form
      1. Problem
      2. Solution
      3. Discussion
    7. 15.7. Use Regular Expressions for Locating Email Addresses
      1. Problem
      2. Solution
      3. Discussion
    8. 15.8. Use Regular Expressions for Matching Credit Card Numbers
      1. Problem
      2. Solution
      3. Discussion
    9. 15.9. Use Regular Expressions for Validating ISBNs
      1. Problem
      2. Solution
      3. Discussion
    10. 15.10. Create Regular Expressions by Using Explicit Character Classes
      1. Problem
      2. Solution
      3. Discussion
    11. 15.11. Use Character Types in Regular Expressions
      1. Problem
      2. Solution
      3. Discussion
    12. 15.12. Match Valid IP Addresses by Using Subexpressions
      1. Problem
      2. Solution
      3. Discussion
    13. 15.13. Use Regular Expressions for Different Types of Matches
      1. Problem
      2. Solution
      3. Discussion
    14. 15.14. Match Ends or Beginnings of Lines with Regular Expressions
      1. Problem
      2. Solution
      3. Discussion
    15. 15.15. Use Back-References
      1. Problem
      2. Solution
      3. Discussion
    16. 15.16. Use a Look-Ahead or Look-Behind
      1. Problem
      2. Solution
      3. Discussion
  19. 16. Charting
    1. 16.1. Create a Chart
      1. Problem
      2. Solution
      3. Discussion
    2. 16.2. Add Effects to Charts
      1. Problem
      2. Solution
      3. Discussion
    3. 16.3. Select Regions of a Chart
      1. Problem
      2. Solution
      3. Discussion
    4. 16.4. Format Tick Marks for a Chart
      1. Problem
      2. Solution
      3. Discussion
    5. 16.5. Create a Custom Label for a Chart
      1. Problem
      2. Solution
      3. Discussion
    6. 16.6. Create a Drill-Down Effect for a Columnar Chart
      1. Problem
      2. Solution
      3. Discussion
    7. 16.7. Skin Chart Items
      1. Problem
      2. Solution
      3. Discussion
    8. 16.8. Use ActionScript to Dynamically Add and Remove Columns for a Chart
      1. Problem
      2. Solution
      3. Discussion
    9. 16.9. Overlap Multiple ChartSeries
      1. Problem
      2. Solution
      3. Discussion
    10. 16.10. Drag and Drop Items in a Chart
      1. Problem
      2. Solution
      3. Discussion
    11. 16.11. Create an Editable Line Chart
      1. Problem
      2. Solution
      3. Discussion
  20. 17. SharedObjects
    1. 17.1. Create a SharedObject
      1. Problem
      2. Solution
      3. Discussion
    2. 17.2. Write Data into a SharedObject
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    3. 17.3. Save a Local SharedObject
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    4. 17.4. Read Data from a SharedObject
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    5. 17.5. Remove Data from a SharedObject
      1. Problem
      2. Solution
      3. Discussion
    6. 17.6. Serialize Typed Objects
      1. Problem
      2. Solution
      3. Discussion
    7. 17.7. Access a SharedObject Between Multiple Flash Applications
      1. Problem
      2. Solution
      3. Discussion
    8. 17.8. Remember TextInput Values for Returning Users
      1. Problem
      2. Solution
      3. Discussion
  21. 18. Working with Services and Server-Side Communication
    1. 18.1. Configure an HTTPService
      1. Problem
      2. Solution
      3. Discussion
    2. 18.2. Use RESTful Communication Between Flex Applications
      1. Problem
      2. Solution
      3. Discussion
    3. 18.3. Configure and Connect to a RemoteObject
      1. Problem
      2. Solution
      3. Discussion
    4. 18.4. Use Flex Remoting with AMFPHP 1.9
      1. Problem
      2. Solution
      3. Discussion
    5. 18.5. Use the IExternalizable Interface for Custom Serialization
      1. Problem
      2. Solution
      3. Discussion
    6. 18.6. Track Results from Multiple Simultaneous Service Calls
      1. Problem
      2. Solution
      3. Discussion
    7. 18.7. Use Publish/Subscribe Messaging
      1. Problem
      2. Solution
      3. Discussion
    8. 18.8. Register a Server-Side Data Type Within a Flex Application
      1. Problem
      2. Solution
      3. Discussion
    9. 18.9. Communicate with a WebService
      1. Problem
      2. Solution
      3. Discussion
    10. 18.10. Add a SOAP Header to a Request to a WebService
      1. Problem
      2. Solution
      3. Discussion
    11. 18.11. Parse a SOAP Response from a WebService
      1. Problem
      2. Solution
      3. Discussion
    12. 18.12. Communicate Securely with AMF by Using SecureAMFChannel
      1. Problem
      2. Solution
      3. Discussion
    13. 18.13. Send and Receive Binary Data via a Binary Socket
      1. Problem
      2. Solution
      3. Discussion
    14. 18.14. Communicate Using an XMLSocket
      1. Problem
      2. Solution
      3. Discussion
  22. 19. XML
    1. 19.1. Load an XML File
      1. Problem
      2. Solution
      3. Discussion
    2. 19.2. Navigate an XML Document in E4X
      1. Problem
      2. Solution
      3. Discussion
    3. 19.3. Use Regular Expressions in E4X Queries
      1. Problem
      2. Solution
      3. Discussion
    4. 19.4. Add an XMLList to an XML Object
      1. Problem
      2. Solution
      3. Discussion
    5. 19.5. Bind to an XMLList or an E4X Query
      1. Problem
      2. Solution
      3. Discussion
    6. 19.6. Generate XML Objects from Arrays
      1. Problem
      2. Solution
      3. Discussion
    7. 19.7. Handle Namespaces in XML Returned by a Service
      1. Problem
      2. Solution
      3. Discussion
    8. 19.8. Encode an ActionScript Data Object as XML
      1. Problem
      2. Solution
      3. Discussion
    9. 19.9. Populate a Component with Complex XML Data
      1. Problem
      2. Solution
      3. Discussion
    10. 19.10. Decode XML from a Web Service into Strongly Typed Objects
      1. Problem
      2. Solution
      3. Discussion
  23. 20. Browser Communication
    1. 20.1. Link to an External URL
      1. Problem
      2. Solution
      3. Discussion
    2. 20.2. Work with FlashVars
      1. Problem
      2. Solution
      3. Discussion
    3. 20.3. Invoke JavaScript Functions from Flex
      1. Problem
      2. Solution
      3. Discussion
    4. 20.4. Invoke ActionScript Functions from JavaScript
      1. Problem
      2. Solution
      3. Discussion
    5. 20.5. Change the HTML Page Title via BrowserManager
      1. Problem
      2. Solution
      3. Discussion
    6. 20.6. Parse the URL via BrowserManager
      1. Problem
      2. Solution
      3. Discussion
    7. 20.7. Deep-Link to Data via BrowserManager
      1. Problem
      2. Solution
      3. Discussion
    8. 20.8. Deep-Link Containers via BrowserManager
      1. Problem
      2. Solution
      3. Discussion
    9. 20.9. Implement Custom History Management
      1. Problem
      2. Solution
      3. Discussion
  24. 21. Development Strategies
    1. 21.1. Use the Flex Component Kit to Create Components
      1. Problem
      2. Solution
      3. Discussion
    2. 21.2. Use the ContainerMovieClip to Create Flex Containers in Flash
      1. Problem
      2. Solution
      3. Discussion
    3. 21.3. Import Components from Flash CS3
      1. Problem
      2. Solution
      3. Discussion
    4. 21.4. Get Started with the Cairngorm Architecture
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    5. 21.5. Create a Cairngorm View, Event, and Model
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    6. 21.6. Create Cairngorm Commands and a Business Delegate Class
      1. Problem
      2. Solution
      3. Discussion
    7. 21.7. Create a Cairngorm FrontController and a ServiceLocator
      1. Problem
      2. Solution
      3. Discussion
    8. 21.8. Generate an Application Structure with the Cairngen Framework Generator
      1. Problem
      2. Solution
      3. Discussion
    9. 21.9. Learn Common Performance-Tuning Tricks
      1. Problem
      2. Solution
      3. Discussion
    10. 21.10. Create Custom Metadata Properties for a Component
      1. Problem
      2. Solution
      3. Discussion
  25. 22. Modules and Runtime Shared Libraries
    1. 22.1. Create a Runtime Shared Library
      1. Problem
      2. Solution
      3. Discussion
    2. 22.2. Use Cross-Domain Runtime Shared Libraries
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    3. 22.3. Use the Flex Framework as a Runtime Shared Library
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    4. 22.4. Optimize a Runtime Shared Library
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    5. 22.5. Create an MXML-Based Module
      1. Problem
      2. Solution
      3. Discussion
    6. 22.6. Create an ActionScript-Based Module
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    7. 22.7. Load a Module by Using ModuleLoader
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    8. 22.8. Use ModuleManager to Load Modules
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    9. 22.9. Load Modules from Different Servers
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    10. 22.10. Communicate with a Module
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    11. 22.11. Pass Data to Modules by Using Query Strings
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    12. 22.12. Optimize Modules by Using Linker Reports
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
  26. 23. The Adobe Integrated Runtime API
    1. 23.1. Create an AIR Application Leveraging the Flex Framework
      1. Problem
      2. Solution
      3. Discussion
    2. 23.2. Understand the AIR Command-Line Tools
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    3. 23.3. Open and Manage Native Windows
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    4. 23.4. Create Native Menus
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    5. 23.5. Read and Write to a File
      1. Problem
      2. Solution
      3. Discussion
    6. 23.6. Serialize Objects
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    7. 23.7. Use the Encrypted Local Store
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    8. 23.8. Browse for Files
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    9. 23.9. Use the AIR File System Controls
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    10. 23.10. Use the Native Drag-and-Drop API
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    11. 23.11. Interact with the Operating System Clipboard
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    12. 23.12. Add HTML Content
      1. Problem
      2. Solution
      3. Discussion
    13. 23.13. Cross-Script Between ActionScript and JavaScript
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    14. 23.14. Work with Local SQL Databases
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    15. 23.15. Detect and Monitor a Network Connection
      1. Problem
      2. Solution
      3. Discussion
    16. 23.16. Detect User Presence
      1. Problem
      2. Solution
      3. Discussion
    17. 23.17. Create System Tray and Dock Applications
      1. Problem
      2. Solution
      3. Discussion
  27. 24. Unit Testing with FlexUnit
    1. 24.1. Create an Application That Uses the FlexUnit Framework
      1. Problem
      2. Solution
      3. Discussion
    2. 24.2. Create an Application to Run FlexUnit Tests
      1. Problem
      2. Solution
      3. Discussion
    3. 24.3. Create a FlexUnit Test Case
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    4. 24.4. Add a Test Case to a Test Suite
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    5. 24.5. Run Code Before and After Every Test
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    6. 24.6. Share Test Data Between Test Cases
      1. Problem
      2. Solution
      3. Discussion
    7. 24.7. Handle Events in a Test Case
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    8. 24.8. Test Visual Components with FlexUnit
      1. Problem
      2. Solution
      3. Discussion
        1. Component testing pattern
        2. Component creation testing
        3. Postcreation testing
        4. Testing with timers
        5. Using programmatic visual assertions
        6. Hiding the component being tested
      4. See Also
    9. 24.9. Install and Configure Antennae
      1. Problem
      2. Solution
      3. Discussion
    10. 24.10. Generate Automated Test Suites
      1. Problem
      2. Solution
      3. Discussion
  28. 25. Compiling and Debugging
    1. 25.1. Use Trace Statements Without Flex Builder
      1. Problem
      2. Solution
      3. Discussion
    2. 25.2. Use the Component Compiler
      1. Problem
      2. Solution
      3. Discussion
    3. 25.3. Install the Flex Ant Tasks
      1. Problem
      2. Solution
      3. Discussion
    4. 25.4. Use the compc and mxmlc Tasks in the Flex Ant Tasks
      1. Problem
      2. Solution
      3. Discussion
    5. 25.5. Compile and Deploy Flex Applications That Use RSLs
      1. Problem
      2. Solution
      3. Discussion
    6. 25.6. Create and Monitor Expressions in Flex Builder Debugging
      1. Problem
      2. Solution
      3. Discussion
    7. 25.7. Install the Ant View in the Stand-Alone Version of Flex Builder
      1. Problem
      2. Solution
      3. Discussion
    8. 25.8. Create an Ant Build File for Automating Common Tasks
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    9. 25.9. Compile a Flex Application by Using mxmlc and Ant
      1. Problem
      2. Solution
      3. Discussion
      4. See Also
    10. 25.10. Generate Documentation by Using ASDoc and Ant
      1. Problem
      2. Solution
      3. Discussion
    11. 25.11. Compile Flex Applications by Using Rake
      1. Problem
      2. Solution
      3. Discussion
    12. 25.12. Use ExpressInstall for Your Application
      1. Problem
      2. Solution
      3. Discussion
    13. 25.13. Use Memory Profiling with Flex Builder 3 to View Memory Snapshots
      1. Problem
      2. Solution
      3. Discussion
  29. 26. Configuration, Internationalization, and Printing
    1. 26.1. Add an International Character Set to an Application
      1. Problem
      2. Solution
      3. Discussion
    2. 26.2. Use a Resource Bundle to Localize an Application
      1. Problem
      2. Solution
      3. Discussion
    3. 26.3. Use the ResourceManager for Localization
      1. Problem
      2. Solution
      3. Discussion
    4. 26.4. Use Resource Modules for Localization
      1. Problem
      2. Solution
      3. Discussion
    5. 26.5. Support IME Devices
      1. Problem
      2. Solution
      3. Discussion
    6. 26.6. Detect a Screen Reader
      1. Problem
      2. Solution
      3. Discussion
    7. 26.7. Create a Tabbing Reading Order for Accessibility
      1. Problem
      2. Solution
      3. Discussion
    8. 26.8. Print Selected Items in an Application
      1. Problem
      2. Solution
      3. Discussion
    9. 26.9. Format Application Content for Printing
      1. Problem
      2. Solution
      3. Discussion
    10. 26.10. Control Printing of Unknown Length Content over Multiple Pages
      1. Problem
      2. Solution
      3. Discussion
    11. 26.11. Add a Header and a Footer When Printing
      1. Problem
      2. Solution
      3. Discussion
  30. Index
  31. About the Authors
  32. Copyright