[书籍]Flex 3 Cookbook Download

Download Flex 3 Cookbook
下载 Flex 3 锦囊妙计
RIAbook Rank:★★★★

简介 Book Description:
The best way to show off a powerful new technology is to demonstrate real-world results with it, and that's exactly what Adobe and O'Reilly have done with Flex 3.
Through it's Flex Cookbook website, Adobe invited users of the Flex 3 beta to post their own solutions for working with this technology, using O'Reilly's popular problem-solution-discussion format. Website monitors (and authors) Joshua Noble and Todd Anderson chose the most useful solutions for Flex 3 Cookbook.
This highly practical book contains more than 200 proven recipes for developing interactive Rich Internet Applications and Web 2.0 sites, including several contributed by Noble, Anderson, and other Flex experts. You'll find everything from Flex basics and working with menus and controls, to methods for compiling, deploying, and configuring Flex applications.
Each recipe features a discussion of how and why it works, and many of them offer sample code that you can put to use immediately. Topics include:
* Menus and controls
* Containers and dialogues
* Working with Text
* List, tiles, trees, and repeaters
* DataGrid and Advanced DataGrid
* Renderers
* Images, videos, and sounds
* CSS and skinning
* Building components
* States and effects
* Collections, arrays, and DataProviders
* DataBinding
* Validation/formatters
* Charting and data visualization
* State management, SharedObjects and LocalConnection
* Working with services and ServerSide communication
* Working with XML
* Communicating with the browser
* Application development strategies
* Runtime and dynamic shared libraries 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 these these recipes. Now that Flex is an open source framework, the user community will continue to supply solutions to extend and improve the technology. This Cookbook offers you the cream of the crop.
目录 Summary of Contents
Copyright
Preface
Chapter 1. Flex and ActionScript Basics
Recipe 1.1. Create a Flex Project in Flex Builder
Recipe 1.2. Create a Flex Library Project in Flex Builder
Recipe 1.3. Create an ActionScript Project
Recipe 1.4. Set Compiler Options for the MXML Compiler in Flex Builder
Recipe 1.5. Compile a Flex Project Outside of Flex Builder
Recipe 1.6. Add an Event Listener in MXML
Recipe 1.7. Set Properties of a Child Defined in MXML in ActionScript
Recipe 1.8. Define Arrays and Objects
Recipe 1.9. Set the Scope of Variables in ActionScript
Recipe 1.10. Create a Component in ActionScript
Recipe 1.11. Use Event Bubbling
Recipe 1.12. Use a Code-Behind Model to Separate MXML and ActionScript
Recipe 1.13. Make Properties of a Component Bindable
Recipe 1.14. Use Custom Events and Dispatch Data with Events
Recipe 1.15. Listen for a Keyboard Event
Recipe 1.16. Define Optional Parameters for Methods
Recipe 1.17. Determine the Type of an Object
Recipe 1.18. Define and Implement an Interface
Chapter 2. Menus and Controls
Recipe 2.1. Listen to a Button Click
Recipe 2.2. Create a Set of Buttons That Toggle
Recipe 2.3. Use a ColorPicker to Set Canvas Color
Recipe 2.4. Load a SWF by Using the SWFLoader
Recipe 2.5. Set Tab Indexes for Components
Recipe 2.6. Set a labelFunction for a Control
Recipe 2.7. Provide Data for Menus
Recipe 2.8. Dynamically Populate Menus
Recipe 2.9. Create EventHandlers for Menu-Based Controls
Recipe 2.10. Display an Alert in an Application
Recipe 2.11. Use the Date from a Calendar Control
Recipe 2.12. Display and Position Multiple Pop-ups
Recipe 2.13. Create a Custom Border for a Pop-up Window
Recipe 2.14. Handle focusIn and focusOut Events
Chapter 3. Containers
Recipe 3.1. Position Children by Using Layout Management
Recipe 3.2. Position and Size Containers via Percentage Positioning
Recipe 3.3. Track Mouse Position Within Different Coordinate Systems
Recipe 3.4. Dynamically Add and Remove Children from a Container
Recipe 3.5. Use Constraint-Based Layout for Containers
Recipe 3.6. Set Maximum and Minimum Sizes for Children Within Containers
Recipe 3.7. Specify Constraint Rows and Columns for a Container
Recipe 3.8. Create Layout Flows for Text Using Constraints
Recipe 3.9. Control Scrolling and Overflow Within Containers
Recipe 3.10. Control the Layout of Box Components
Recipe 3.11. Use Containers for Initialization
Recipe 3.12. Create a TitleWindow
Recipe 3.13. Control a ViewStack via a LinkBar
Recipe 3.14. Bind the Selected Index of a ViewStack to a Variable
Recipe 3.15. Use Delayed Instantiation to Improve Startup Time
Recipe 3.16. Create and Control Resizable Containers
Recipe 3.17. Create, Enable, and Disable TabControls Within a TabNavigator
Recipe 3.18. Create a TabNavigator with Closeable Tabs
Recipe 3.19. Create and Control an Alert
Recipe 3.20. Size and Position a Dialog Box Based on Its Calling Component
Recipe 3.21. Manage Multiple Pop-up Dialog Boxes
Recipe 3.22. Scroll to a Specific Child in a Container
Recipe 3.23. Create a Template Using IDeferredInstance
Recipe 3.24. Manually Lay Out a Container
Recipe 3.25. Measure and Alter Container Size
Recipe 3.26. Control the Visibility and Layout of Children
Recipe 3.27. Create a Tile Container with Simple Reorganization
Recipe 3.28. Set a Background Image and Rounded Corners in an HBox
Recipe 3.29. Control Positioning and Scrolling of Child Components
Chapter 4. Text
Recipe 4.1. Correctly Set the Value of a Text Object
Recipe 4.2. Bind a Value to TextInput
Recipe 4.3. Create a Suggestive TextInput
Recipe 4.4. Create an In-Place Editor
Recipe 4.5. Determine All Fonts Installed on a User's Computer
Recipe 4.6. Create a Custom TextInput
Recipe 4.7. Set the Style Properties for Text Ranges
Recipe 4.8. Display Images and SWFs in HTML
Recipe 4.9. Highlight User-Input Text in a Search Field
Recipe 4.10. Manipulate Characters as Individual Graphics
Recipe 4.11. Specify Styles for HTML in a TextField
Recipe 4.12. Use the RichTextEditor
Recipe 4.13. Apply Embedded Fonts with HTML
Recipe 4.14. Add a Drop Shadow to Text in a Text Component
Recipe 4.15. Find the Last Displayed Character in a TextArea
Chapter 5. Lists, Tiles, and Trees
Recipe 5.1. Create an Editable List
Recipe 5.2. Set Icons for Items in a List
Recipe 5.3. Add Effects to a List to Indicate Changes
Recipe 5.4. Set a Basic Item Renderer for a TileList
Recipe 5.5. Set XML Data for a Tree
Recipe 5.6. Create an Item Renderer for a Tree
Recipe 5.7. Use Complex Data Objects in a Tree Control
Recipe 5.8. Allow Only Certain Items in a List to Be Selectable
Recipe 5.9. Format and Validate Data Added in a List's Item Editor
Recipe 5.10. Track All Selected Children in a TileList
Recipe 5.11. Use and Display Null Items in an Item Renderer
Recipe 5.12. Create a Right-Click Menu for a List
Recipe 5.13. Customize the Appearance of a Selection in a List
Chapter 6. DataGrid and Advanced DataGrid
Recipe 6.1. Create Custom Columns for a DataGrid
Recipe 6.2. Specify Sort Functions for DataGrid Columns
Recipe 6.3. Enable Multicolumn Sorting in a DataGrid
Recipe 6.4. Filter Items in a DataGrid
Recipe 6.5. Create Custom Headers for an AdvancedDataGrid
Recipe 6.6. Handle Events from a DataGrid/AdvancedDataGrid
Recipe 6.7. Select Items in an AdvancedDataGrid
Recipe 6.8. Enable Drag-and-Drop in a DataGrid
Recipe 6.9. Edit Items in a DataGrid
Recipe 6.10. Search Within a DataGrid and Autoscroll to the Match
Recipe 6.11. Generate a Summary for Flat Data by Using GroupingCollection
Recipe 6.12. Create an Async Refresh for a GroupingCollection
Chapter 7. Renderers and Editors
Recipe 7.1. Create Your Own Renderers
Recipe 7.2. Use the ClassFactory to Generate Renderers
Recipe 7.3. Access the Component That Owns a Renderer
Recipe 7.4. Create a Single Component to Act as Renderer and Editor
Recipe 7.5. Create an Item Editor to Handle Data with Multiple Fields
Recipe 7.6. Display SWF Objects as Items in a Menu by Using an Item Renderer
Recipe 7.7. Select a DataGrid Column with a CheckBox Header Renderer
Recipe 7.8. Create a Self-Contained CheckBox itemRenderer for Use in a DataGrid
Recipe 7.9. Efficiently Set Images in a Renderer
Recipe 7.10. Use Runtime Styling with itemRenderers and itemEditors
Recipe 7.11. Use States and Transitions with an itemEditor
Recipe 7.12. Create a CheckBox Tree Control
Recipe 7.13. Resize Renderers Within a List
Chapter 8. Images, Bitmaps, Videos, Sounds
Recipe 8.1. Load and Display an Image
Recipe 8.2. Create a Video Display
Recipe 8.3. Play and Pause an MP3 File
Recipe 8.4. Create a Seek Bar for a Sound File
Recipe 8.5. Blend Two Images
Recipe 8.6. Apply a Convolution Filter to an Image
Recipe 8.7. Send Video to an FMS Instance via a Camera
Recipe 8.8. Access a User's Microphone and Create a Sound Display
Recipe 8.9. Smooth Video Displayed in a Flex Application
Recipe 8.10. Check Pixel-Level Collisions
Recipe 8.11. Read and Save a User's Webcam Image
Recipe 8.12. Use Blend Modes with Multiple Images
Recipe 8.13. Handle Cue Points in FLV Data
Recipe 8.14. Create a Video Scrubber
Recipe 8.15. Read ID3 Data from an MP3 File
Recipe 8.16. Display a Custom Loader while Loading Images
Recipe 8.17. Enable Image Upload in Flex
Recipe 8.18. Compare Two Bitmap Images
Chapter 9. Skinning and Styling
Recipe 9.1. Use CSS to Style Components
Recipe 9.2. Override the Default Application Style
Recipe 9.3. Embed Styles by Using CSS
Recipe 9.4. Override Base Style Properties
Recipe 9.5. Customize Styles at Runtime
Recipe 9.6. Load CSS at Runtime
Recipe 9.7. Declare Styles at Runtime
Recipe 9.8. Create Custom Style Properties for Components
Recipe 9.9. Use Multiple Themes in the Same Application
Recipe 9.10. Compile a Theme SWC
Recipe 9.11. Use Embedded Fonts
Recipe 9.12. Embed Fonts from a SWF File
Recipe 9.13. Skin with Embedded Images
Recipe 9.14. Apply Skins from a SWF File
Recipe 9.15. Programmatically Skin a Component
Recipe 9.16. Programmatically Skin a Stateful Control
Recipe 9.17. Create Animated Skins from a SWF File
Recipe 9.18. Customize the Preloader
Chapter 10. Dragging and Dropping
Recipe 10.1. Use the DragManager Class
Recipe 10.2. Specify a Drag Proxy
Recipe 10.3. Drag and Drop Within a List
Recipe 10.4. Drag and Drop Between Lists
Recipe 10.5. Enable and Disable Drag Operations
Recipe 10.6. Customize the DragImage of a List-Based Control
Recipe 10.7. Customize the Drop Indicator of a List-Based Control
Chapter 11. States
Recipe 11.1. Set Styles and Properties in a State
Recipe 11.2. Create Transitions to Enter and Leave States
Recipe 11.3. Use the AddChildAction and RemoveChildAction
Recipe 11.4. Filter Transitions to Affect Only Certain Types of Children
Recipe 11.5. Apply Parts of a Transition to Certain Children
Recipe 11.6. Base a State on Another State
Recipe 11.7. Integrate View States with HistoryManagement
Recipe 11.8. Use Deferred Instance Factories with States
Recipe 11.9. Use Data Binding with Objects Added in a State
Recipe 11.10. Add and Remove Event Listeners in State Changes
Recipe 11.11. Add View States to a Flash Component
Recipe 11.12. Work with State Change Events
Recipe 11.13. Dynamically Generate and Use New States and Transitions
Recipe 11.14. Create Custom Actions to Use in a State
Chapter 12. Effects
Recipe 12.1. Call an Effect in MXML and in ActionScript
Recipe 12.2. Build a Custom Effect
Recipe 12.3. Create Parallel Series or Sequences of Effects
Recipe 12.4. Pause, Reverse, and Restart an Effect
Recipe 12.5. Create Custom Effect Triggers
Recipe 12.6. Create Tween Effects
Recipe 12.7. Use the DisplacementMapFilter Filter in a Flex Effect
Recipe 12.8. Create an AnimateColor Effect
Recipe 12.9. Use the Convolution Filter to Create a Tween
Chapter 13. Collections
Recipe 13.1. Add, Sort, and Retrieve Data from an ArrayCollection
Recipe 13.2. Filter an ArrayCollection
Recipe 13.3. Determine When an Item Is Modified in an ArrayCollection
Recipe 13.4. Create a GroupingCollection
Recipe 13.5. Create a Hierarchical Data Provider for a Control
Recipe 13.6. Navigate a Collection Object and Save Your Position
Recipe 13.7. Create a HierarchicalViewCollection Object
Recipe 13.8. Filter and Sort an XMLListCollection
Recipe 13.9. Sort on Multiple Fields in a Collection
Recipe 13.10. Sort on Dates in a Collection
Recipe 13.11. Create a Deep Copy of an ArrayCollection
Recipe 13.12. Use Data Objects with Unique IDs
Chapter 14. Data Binding
Recipe 14.1. Bind to a Property
Recipe 14.2. Bind to a Function
Recipe 14.3. Create a Bidirectional Binding
Recipe 14.4. Bind to Properties by Using ActionScript
Recipe 14.5. Use Bindable Property Chains
Recipe 14.6. Bind to Properties on XML by Using E4X
Recipe 14.7. Create Customized Bindable Properties
Recipe 14.8. Bind to a Generic Object
Recipe 14.9. Bind to Properties on a Dynamic Class
Chapter 15. Validation, Formatting, and Regular Expressions
Recipe 15.1. Use Validators and Formatters with TextInput and TextArea Controls
Recipe 15.2. Create a Custom Formatter
Recipe 15.3. Create a More-International Zip Code Validator by Using Regular Expressions
Recipe 15.4. Create a Validator to Validate UPCs
Recipe 15.5. Validate Combo Boxes and Groups of Radio Buttons
Recipe 15.6. Show Validation Errors by Using ToolTips in a Form
Recipe 15.7. Use Regular Expressions for Locating Email Addresses
Recipe 15.8. Use Regular Expressions for Matching Credit Card Numbers
Recipe 15.9. Use Regular Expressions for Validating ISBNs
Recipe 15.10. Create Regular Expressions by Using Explicit Character Classes
Recipe 15.11. Use Character Types in Regular Expressions
Recipe 15.12. Match Valid IP Addresses by Using Subexpressions
Recipe 15.13. Use Regular Expressions for Different Types of Matches
Recipe 15.14. Match Ends or Beginnings of Lines with Regular Expressions
Recipe 15.15. Use Back-References
Recipe 15.16. Use a Look-Ahead or Look-Behind
Chapter 16. Charting
Recipe 16.1. Create a Chart
Recipe 16.2. Add Effects to Charts
Recipe 16.3. Select Regions of a Chart
Recipe 16.4. Format Tick Marks for a Chart
Recipe 16.5. Create a Custom Label for a Chart
Recipe 16.6. Create a Drill-Down Effect for a Columnar Chart
Recipe 16.7. Skin Chart Items
Recipe 16.8. Use ActionScript to Dynamically Add and Remove Columns for a Chart
Recipe 16.9. Overlap Multiple ChartSeries
Recipe 16.10. Drag and Drop Items in a Chart
Recipe 16.11. Create an Editable Line Chart
Chapter 17. SharedObjects
Recipe 17.1. Create a SharedObject
Recipe 17.2. Write Data into a SharedObject
Recipe 17.3. Save a Local SharedObject
Recipe 17.4. Read Data from a SharedObject
Recipe 17.5. Remove Data from a SharedObject
Recipe 17.6. Serialize Typed Objects
Recipe 17.7. Access a SharedObject Between Multiple Flash Applications
Recipe 17.8. Remember TextInput Values for Returning Users
Chapter 18. Working with Services and Server-Side Communication
Recipe 18.1. Configure an HTTPService
Recipe 18.2. Use RESTful Communication Between Flex Applications
Recipe 18.3. Configure and Connect to a RemoteObject
Recipe 18.4. Use Flex Remoting with AMFPHP 1.9
Recipe 18.5. Use the IExternalizable Interface for Custom Serialization
Recipe 18.6. Track Results from Multiple Simultaneous Service Calls
Recipe 18.7. Use Publish/Subscribe Messaging
Recipe 18.8. Register a Server-Side Data Type Within a Flex Application
Recipe 18.9. Communicate with a WebService
Recipe 18.10. Add a SOAP Header to a Request to a WebService
Recipe 18.11. Parse a SOAP Response from a WebService
Recipe 18.12. Communicate Securely with AMF by Using SecureAMFChannel
Recipe 18.13. Send and Receive Binary Data via a Binary Socket
Recipe 18.14. Communicate Using an XMLSocket
Chapter 19. XML
Recipe 19.1. Load an XML File
Recipe 19.2. Navigate an XML Document in E4X
Recipe 19.3. Use Regular Expressions in E4X Queries
Recipe 19.4. Add an XMLList to an XML Object
Recipe 19.5. Bind to an XMLList or an E4X Query
Recipe 19.6. Generate XML Objects from Arrays
Recipe 19.7. Handle Namespaces in XML Returned by a Service
Recipe 19.8. Encode an ActionScript Data Object as XML
Recipe 19.9. Populate a Component with Complex XML Data
Recipe 19.10. Decode XML from a Web Service into Strongly Typed Objects
Chapter 20. Browser Communication
Recipe 20.1. Link to an External URL
Recipe 20.2. Work with FlashVars
Recipe 20.3. Invoke JavaScript Functions from Flex
Recipe 20.4. Invoke ActionScript Functions from JavaScript
Recipe 20.5. Change the HTML Page Title via BrowserManager
Recipe 20.6. Parse the URL via BrowserManager
Recipe 20.7. Deep-Link to Data via BrowserManager
Recipe 20.8. Deep-Link Containers via BrowserManager
Recipe 20.9. Implement Custom History Management
Chapter 21. Development Strategies
Recipe 21.1. Use the Flex Component Kit to Create Components
Recipe 21.2. Use the ContainerMovieClip to Create Flex Containers in Flash
Recipe 21.3. Import Components from Flash CS3
Recipe 21.4. Get Started with the Cairngorm Architecture
Recipe 21.5. Create a Cairngorm View, Event, and Model
Recipe 21.6. Create Cairngorm Commands and a Business Delegate Class
Recipe 21.7. Create a Cairngorm FrontController and a ServiceLocator
Recipe 21.8. Generate an Application Structure with the Cairngen Framework Generator
Recipe 21.9. Learn Common Performance-Tuning Tricks
Recipe 21.10. Create Custom Metadata Properties for a Component
Chapter 22. Modules and Runtime Shared Libraries
Recipe 22.1. Create a Runtime Shared Library
Recipe 22.2. Use Cross-Domain Runtime Shared Libraries
Recipe 22.3. Use the Flex Framework as a Runtime Shared Library
Recipe 22.4. Optimize a Runtime Shared Library
Recipe 22.5. Create an MXML-Based Module
Recipe 22.6. Create an ActionScript-Based Module
Recipe 22.7. Load a Module by Using ModuleLoader
Recipe 22.8. Use ModuleManager to Load Modules
Recipe 22.9. Load Modules from Different Servers
Recipe 22.10. Communicate with a Module
Recipe 22.11. Pass Data to Modules by Using Query Strings
Recipe 22.12. Optimize Modules by Using Linker Reports
Chapter 23. The Adobe Integrated Runtime API
Recipe 23.1. Create an AIR Application Leveraging the Flex Framework
Recipe 23.2. Understand the AIR Command-Line Tools
Recipe 23.3. Open and Manage Native Windows
Recipe 23.4. Create Native Menus
Recipe 23.5. Read and Write to a File
Recipe 23.6. Serialize Objects
Recipe 23.7. Use the Encrypted Local Store
Recipe 23.8. Browse for Files
Recipe 23.9. Use the AIR File System Controls
Recipe 23.10. Use the Native Drag-and-Drop API
Recipe 23.11. Interact with the Operating System Clipboard
Recipe 23.12. Add HTML Content
Recipe 23.13. Cross-Script Between ActionScript and JavaScript
Recipe 23.14. Work with Local SQL Databases
Recipe 23.15. Detect and Monitor a Network Connection
Recipe 23.16. Detect User Presence
Recipe 23.17. Create System Tray and Dock Applications
Chapter 24. Unit Testing with FlexUnit
Recipe 24.1. Create an Application That Uses the FlexUnit Framework
Recipe 24.2. Create an Application to Run FlexUnit Tests
Recipe 24.3. Create a FlexUnit Test Case
Recipe 24.4. Add a Test Case to a Test Suite
Recipe 24.5. Run Code Before and After Every Test
Recipe 24.6. Share Test Data Between Test Cases
Recipe 24.7. Handle Events in a Test Case
Recipe 24.8. Test Visual Components with FlexUnit
Recipe 24.9. Install and Configure Antennae
Recipe 24.10. Generate Automated Test Suites
Chapter 25. Compiling and Debugging
Recipe 25.1. Use Trace Statements Without Flex Builder
Recipe 25.2. Use the Component Compiler
Recipe 25.3. Install the Flex Ant Tasks
Recipe 25.4. Use the compc and mxmlc Tasks in the Flex Ant Tasks
Recipe 25.5. Compile and Deploy Flex Applications That Use RSLs
Recipe 25.6. Create and Monitor Expressions in Flex Builder Debugging
Recipe 25.7. Install the Ant View in the Stand-Alone Version of Flex Builder
Recipe 25.8. Create an Ant Build File for Automating Common Tasks
Recipe 25.9. Compile a Flex Application by Using mxmlc and Ant
Recipe 25.10. Generate Documentation by Using ASDoc and Ant
Recipe 25.11. Compile Flex Applications by Using Rake
Recipe 25.12. Use ExpressInstall for Your Application
Recipe 25.13. Use Memory Profiling with Flex Builder 3 to View Memory Snapshots
Chapter 26. Configuration, Internationalization, and Printing
Recipe 26.1. Add an International Character Set to an Application
Recipe 26.2. Use a Resource Bundle to Localize an Application
Recipe 26.3. Use the ResourceManager for Localization
Recipe 26.4. Use Resource Modules for Localization
Recipe 26.5. Support IME Devices
Recipe 26.6. Detect a Screen Reader
Recipe 26.7. Create a Tabbing Reading order for Accessibility
Recipe 26.8. Print Selected Items in an Application
Recipe 26.9. Format Application Content for Printing
Recipe 26.10. Control Printing of Unknown Length Content over Multiple Pages
Recipe 26.11. Add a Header and a Footer When Printing
Index
关于作者 About the Author
Joshua Noble
A development consultant based in New York City, is the co-author of ActionScript 3.0 Bible (Wiley, 2007). He has worked with Flex and Flash on a wide range of web applications on a variety of platforms over the past six years as well as working with PHP, Ruby, Erlang, and C#. In his free time, he enjoys playing with C++ and OpenCV as well as using microcontrollers and sensors to create reactive environments. His website is http://thefactoryfactory.com.
Todd Anderson
A senior software engineer for Infrared5. With over five years of developing for the Flash platform in the areas of RIA and game development, Todd has delivered web and desktop solutions for the publishing and entertainment industries with companies including McGraw-Hill, Thomson, Motorola, and Condé Nast Publications. Currently residing in the Boston area, when he's not programming he likes to get back to his fine arts roots and build things on paper. Anderson runs www.custardbelly.com/blog, focusing on development of the Flash platform.
http download
From rapidshare : Flex 3 Cookbook

赞(0) 打赏
分享到: 更多 (0)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏