Cover image for Learning Flex 3

Book description

How soon can you learn Adobe Flex 3? With this book's unique hands-on approach, you will be able to tinker with examples right away, and create your own Rich Internet Applications with Flex within the first few chapters. As you progress, you learn how to build a layout, add interactivity, work with data, and deploy your applications to either the Web or the desktop. Learning Flex 3 offers step-by-step instructions that are clear and concise, along with tips and tricks that author Alaric Cole has gathered after years of using Flex and teaching it to fellow developers at Yahoo! You'll understand how Flex works, how to use the MXML markup language and work with ActionScript, how to deploy RIAs to the desktop using Adobe AIR, and much more. Whether you're a beginner, or an experienced web developer coming to Flex from another platform, Learning Flex 3 is the ideal way to learn how to:

  • Set up your environment with FlexBuilder and Eclipse

  • Create a new Flex project

  • Use the different design views in Flex

  • Write code with MXML

  • Lay out your Flex application

  • Embed images and graphics

  • Build a user interface

  • Add interactivity with ActionScript

  • Handle user input

  • Move, display, and collect data

  • Add custom components with MXML

  • Add sound effects, filters, and transitions

  • Style your applications with CSS, skins, and themes

  • Deploy applications to the Web, or to the desktop using Adobe AIR

Also included are brief explanations of objects, classes, components, properties, methods, types, and other Flex attributes. You will find that Learning Flex 3 is not only the most complete tutorial for Flex, it's also the quickest way to get going with the latest version of this powerful framework.

Table of Contents

  1. Special Upgrade Offer
  2. A Note Regarding Supplemental Files
  3.  
  4. PREFACE
    1. Who This Book Is For
    2. How This Book Is Organized
    3. What This Book Covers
    4. Companion Website
    5. Typographical Conventions Used in This Book
    6. Using the Code Examples
    7. We’d Like to Hear from You
    8. Acknowledgments
  5. 1. GETTING UP TO SPEED
    1. What Is Flex?
      1. Flex Is a Modern, Hybrid Language
      2. Flex Is Flash
      3. Flex Is the Flex SDK
    2. What about AIR?
    3. Where Flex Fits
    4. Why Use Flex?
      1. Flex Is for Applications
      2. For Easy Interactivity
      3. For Development Speed
      4. For Speed All Around
      5. Because It’s Clean
      6. Because It’s Free
      7. Because It’s Open
      8. For Data (and Fast)
      9. Because It’s Beautiful
    5. How Flex Compares to Other Technologies
      1. Flash IDE
      2. C Languages
      3. Java/Java FX
      4. HTML/JavaScript/Ajax
      5. Silverlight/XAML
      6. OpenLaszlo
    6. When Not to Use Flex
    7. Summary
  6. 2. SETTING UP YOUR ENVIRONMENT
    1. Using Alternatives to Flex Builder
    2. Introducing Flex Builder and Eclipse
      1. Flex Flavors
      2. Flex Builder Installation
      3. Your Editor at a Glance
    3. Running Your First Application
      1. Importing a Project Archive
      2. Opening a Sample Application
        1. The Little Green Button: Running the Application
      3. Everything Is a Project
      4. Importing an Existing Project
      5. Cooking from Scratch: Creating a New Flex Project
      6. The Structure of a Flex Project
    4. Summary
  7. 3. USING DESIGN MODE
    1. A Blank Slate: Your Canvas
    2. Adding Components to the Application
    3. Moving Components Around
    4. Exploring Common Components
      1. Controls
      2. Layout Containers
      3. Navigators
    5. Modifying Properties Directly
      1. Everything at Your Fingertips: The Properties Panel
        1. Standard View
        2. Category View
        3. Alphabetical View
      2. Common Properties
      3. Building a User Interface
    6. Summary
  8. 4. USING SOURCE MODE
    1. What Design Mode Does
    2. Anatomy of a Flex Application
    3. Components Added in Source Mode
    4. Code Completion
    5. MXML in Depth
      1. The XML in MXML
        1. It’s all about structure
        2. A few ground rules
      2. The Anatomy of a Tag
      3. The
      4. I Do Declare
    6. Summary
  9. 5. LEARNING THE BASICS OF SCRIPTING
    1. Getting Ready
    2. Inline ActionScript
    3. Dot Notation
    4. Assignment
    5. Functions
      1. Where to Place a Function
      2. How to Create a Function
      3. Function Access
      4. Function Parameters
      5. Methods
    6. Variables
    7. Data Types
    8. Objects
    9. Classes
    10. MXML and ActionScript Work Together
    11. ActionScript’s Relationship with MXML
      1. MXML = ActionScript
      2. Tags Are Classes
      3. Attributes Are Properties
      4. Attributes Are Styles
      5. Attributes Are Event Listeners, Too
    12. Comments?
    13. Summary
  10. 6. ADDING INTERACTIVITY WITH ACTIONSCRIPT
    1. Understanding Events
    2. Handling Events Inline
    3. Using Event Constants
    4. Making Things Happen
      1. Using Pop-up Alerts to Display Information
      2. Using Change Events
    5. Debugging for Kicks
      1. Outputting Information to the Console
      2. Using Event Parameters in Debugging
      3. Using Breakpoints
      4. Seeing a New Perspective
      5. Ending Your Debug Session
    6. Summary
  11. 7. USING DATA BINDING
    1. What Is Data Binding?
    2. How to Use It
      1. Basic Usage
      2. Multiple Destinations
      3. Concatenation
      4. More Uses for Curly Braces
      5. The <mx:Binding/> Tag
        1. Basic usage
        2. Multiple sources
      6. Binding Tags vs. Curly Brace Syntax
    3. Implementing Two-Way Bindings
    4. Storing Complex Data
      1. Basic Usage
      2. Multilevel Bindings
    5. Creating Bindable Variables in ActionScript
    6. Determining When Data Binding Isn’t Appropriate
    7. Putting Data Binding to Work for You
    8. Summary
  12. 8. LAYING OUT YOUR APPLICATIONS
    1. Types of Layouts
      1. Absolute Positioning
      2. Relative Positioning
    2. The Display List
      1. How It Works
      2. Accessing Children
      3. Adding and Removing Children
      4. Rearranging Children
    3. Sizing
      1. Explicit Sizing
      2. Relative or Percentage-Based Sizing
      3. Minimum and Maximum Sizes
    4. Layout Container Options
      1. Padding Layout
      2. Gaps
    5. Advanced Containers
      1. Divided Boxes
      2. Tiles
      3. Grid
      4. Form
    6. Layout Controls
      1. Spacer
      2. HRule and VRule
    7. Alignment
    8. Constraints-Based Layout
      1. Typical Usage
      2. Constraint Rows and Columns
    9. Summary
  13. 9. CREATING RICH FORMS
    1. Preparing the Application
    2. Validating Data
      1. Using Validators
        1. StringValidator
        2. EmailValidator
        3. PhoneNumberValidator
        4. ZipCodeValidator
        5. Other available validators
      2. Custom Validation Techniques
    3. Restricting Input
    4. Formatting Data for Display
    5. Summary
  14. 10. GATHERING AND DISPLAYING DATA
    1. Using List Controls
      1. Lists of Simple Data
      2. Lists of Complex Data
        1. Custom label fields
        2. Advanced lists
    2. Using XML Data
      1. Loading External Data at Compile Time
      2. Loading External Data at Runtime
    3. Implementing List Selection
    4. Connecting to Search Results
    5. Dragging and Dropping in Lists
    6. Using Inline Item Renderers
    7. Exploring Other Types of Service Components
      1. WebService
      2. RemoteObject
    8. Summary
  15. 11. CONTROLLING FLOW AND VISIBILITY
    1. Controlling Visibility
    2. Navigation Components
    3. Creating a Photo Gallery Application
      1. Adding Multiple Views
      2. Populating the Gallery via XML
      3. Displaying External Images
      4. Monitoring Loading Progress of Images
      5. Customizing the TileList
      6. Syncing Two Lists
    4. Summary
  16. 12. WORKING WITH VIEW STATES
    1. Scenarios for States
    2. Creating New States
    3. Modifying State Properties, Styles, and Events
    4. Adding Components
    5. Putting States to the Test
      1. The Search Application
        1. Removing components
        2. Setting the initial state
      2. The ContactManager Application
        1. Making the application modular
        2. Cutting and pasting code
        3. Creating component properties
        4. Using custom components
        5. Organizing custom components with packages
        6. Using custom component properties
    6. Summary
  17. 13. APPLYING BEHAVIORS, TRANSITIONS, AND FILTERS
    1. Behaviors
      1. Using Common Effects
      2. Applying Effects to Navigator Containers
      3. Exploring More Effects
      4. Customizing Effects
      5. Using Composite Effects
        1. Parallel
        2. Sequence
    2. Common Effects and Their Properties
      1. Blur
      2. Dissolve
      3. Fade
      4. Glow
      5. Iris
      6. Move
      7. Resize
      8. Rotate
      9. WipeLeft, WipeRight, WipeUp, and WipeDown
      10. Zoom
      11. AnimateProperty
    3. Sound Effects
    4. States Made More Interesting
      1. Using Action Effects
      2. Filtering Effect Targets
    5. Filters
      1. Applying Filters
    6. Summary
  18. 14. STYLING APPLICATIONS
    1. Using Inline Styles
    2. Using Style Sheets
      1. CSS Syntax
        1. Class selector styles
        2. Type selector styles
        3. Global styles
      2. External Style Sheets
    3. Embedding Assets
      1. Embedding Icons
      2. Embedding Sounds
      3. Embedding Fonts
    4. Skinning
      1. Scaling Skins
    5. Using Themes
    6. Summary
  19. 15. DEPLOYING YOUR APPLICATION
    1. Deploying to the Web
      1. Modifying Build Settings
        1. Flex SDK version
        2. Non-embedded files
        3. Accessibility
        4. Compiler warnings
        5. HTML wrapper
        6. Flash Player version
        7. Browser navigation integration
      2. Exporting a Release Build
      3. Sharing Source Code
      4. Setting Where to Export Files
      5. Decreasing Download Time
      6. Hosting Your Application
    2. Deploying to the Desktop
      1. Creating an Adobe AIR Project
      2. Customizing the Application
      3. Exporting an Installer
      4. Creating a Seamless Install
    3. Summary
  20. Index
  21. About the Author
  22. Special Upgrade Offer
  23. Copyright