Flash 8 Cookbook

book cover
Flash 8 Cookbook
By Joey Lott
Publisher: O'Reilly
Pub Date: April 2006
Print ISBN-10: 0-596-10240-2
Print ISBN-13: 978-0-59-610240-1
Pages: 534

Table of Contents  | Index

This practical, nuts-and-bolts toolkit puts theory into practice with ready-made answers to common Flash development questions. It's the perfect resource for Flash developers, as well as designers who are ready to start doing development work.

Flash 8 Cookbook offers quick look-up (and cross-referenced) recipes in four main categories:

  • Creating Flash Content

  • Building Interactive Flash Interfaces

  • Adding Multimedia and Data

  • Planning Flash Projects

Using O'Reilly's popular Problem/Solution/Discussion Cookbook format, this book offers 280 standalone recipes that include a brief explanation of how and why the solution works, so you can adapt it to similar situations you may run across in the future. For people who say, "I understand everything in theory, but I don't know where to start in practice," this book offers ready-to-use answers to real-world problems.

Joey Lott is the author of ActionScript Cookbook (O'Reilly) and co-author of Flash MX 2004 ActionScript Bible (Wiley). He's a leading speaker and consultant in the Flash development community.

book cover
Flash 8 Cookbook
By Joey Lott
Publisher: O'Reilly
Pub Date: April 2006
Print ISBN-10: 0-596-10240-2
Print ISBN-13: 978-0-59-610240-1
Pages: 534

Table of Contents  | Index

        Chapter 1.  Drawing in Flash
      Recipe 1.1.  Drawing Straight Lines
      Recipe 1.2.  Drawing Curved Lines
      Recipe 1.3.  Modifying Curves
      Recipe 1.4.  Selecting a Line
      Recipe 1.5.  Applying Line Styles
      Recipe 1.6.  Controlling How Lines Scale
      Recipe 1.7.  Customizing Line Caps
      Recipe 1.8.  Customizing Join Styles Between Line Segments
      Recipe 1.9.  Creating Effects with Strokes
      Recipe 1.10.  Drawing Primitive Shapes
      Recipe 1.11.  Drawing Regular Polygons
      Recipe 1.12.  Drawing Stars
      Recipe 1.13.  Drawing Other Assorted Shapes
      Recipe 1.14.  Building Complex Shapes from Simple Shapes
      Recipe 1.15.  Drawing Complex Lines and Shapes
      Recipe 1.16.  Repositioning Points on Paths
      Recipe 1.17.  Freehand Drawing
      Recipe 1.18.  Smoothing and Straightening Lines
      Recipe 1.19.  Painting Shapes
      Recipe 1.20.  Tapered Painting Using a Pressure-Sensitive Graphics Tablet
      Recipe 1.21.  Selecting a Shape and Changing Its Attributes
      Recipe 1.22.  Applying a Stroke to a Fill
      Recipe 1.23.  Applying a Fill to a Closed Path
      Recipe 1.24.  Filling in Paths with Gaps
      Recipe 1.25.  Mixing Custom Colors
      Recipe 1.26.  Saving and Reusing Custom Colors
      Recipe 1.27.  Applying Preset and Custom Gradients
      Recipe 1.28.  Applying a Fill Across Multiple Elements
      Recipe 1.29.  Stretching, Rotating, and Repositioning Fills
      Recipe 1.30.  Scaling Elements
      Recipe 1.31.  Distorting and Reshaping Elements
      Recipe 1.32.  Rotating Elements
      Recipe 1.33.  Creating Mirror Images
      Recipe 1.34.  Positioning Elements Precisely
      Recipe 1.35.  Erasing Content
        Chapter 2.  Importing and Exporting Artwork
      Recipe 2.1.  Importing Assets from Fireworks
      Recipe 2.2.  Importing Content from Freehand MX
      Recipe 2.3.  Importing Simulated 3D Shapes from Freehand MX
      Recipe 2.4.  Importing Acrobat PDF Content
      Recipe 2.5.  Importing Illustrator AI and EPS Content
      Recipe 2.6.  Exporting Single-Frame Images
      Recipe 2.7.  Exporting Animated GIF Files
      Recipe 2.8.  Exporting Image Maps (HTML Images with Clickable Regions)
        Chapter 3.  Structuring Movies and Laying Out Content
      Recipe 3.1.  Setting the Background Color
      Recipe 3.2.  Setting Stage Dimensions
      Recipe 3.3.  Setting the Frame Rate
      Recipe 3.4.  Applying New Default Document Settings
      Recipe 3.5.  Creating Document Templates
      Recipe 3.6.  Lengthening the Duration of the Movie
      Recipe 3.7.  Changing Contents on Stage
      Recipe 3.8.  Managing Content with Layers
      Recipe 3.9.  Hiding, Locking, and Customizing the Display of Layer Content
      Recipe 3.10.  Customizing the Display of Layers and Frames
      Recipe 3.11.  Using Guide Layers
      Recipe 3.12.  Managing Complex Content with Layer Folders
      Recipe 3.13.  Laying Out Page Elements Proportionately
      Recipe 3.14.  Aligning, Distributing, Resizing, and Spacing Elements
      Recipe 3.15.  Nudging Elements with the Keyboard
      Recipe 3.16.  Grouping Elements
      Recipe 3.17.  Reusing Elements: Creating Symbols
        Chapter 4.  Creating Animation
      Recipe 4.1.  Animating Changes in Location or Appearance
      Recipe 4.2.  Animating Along Curved Paths
      Recipe 4.3.  Applying Acceleration and Deceleration with Easing
      Recipe 4.4.  Applying Advanced Tweening Effects
      Recipe 4.5.  Animating Rotation
      Recipe 4.6.  Looping Animations
      Recipe 4.7.  Previewing Playback
      Recipe 4.8.  Viewing Multiple Frames Simultaneously
      Recipe 4.9.  Editing Many Frames Simultaneously
      Recipe 4.10.  Morphing Graphics with Shape Tweens
      Recipe 4.11.  Controlling Morphing
      Recipe 4.12.  Creating Nested Animations
      Recipe 4.13.  Copying Animations
      Recipe 4.14.  Changing a Movie Clip's Location at Runtime with ActionScript
      Recipe 4.15.  Animating Runtime Location Changes with ActionScript
        Chapter 5.  Simulating 3D in Flash
      Recipe 5.1.  Solutions for Integrating 3D with Flash Projects
      Recipe 5.2.  Creating 3D Objects
      Recipe 5.3.  Adding Simple 3D Animation to Flash
      Recipe 5.4.  Animating a 3D Shape Morph
      Recipe 5.5.  Vector-Based 3D Graphics
      Recipe 5.6.  Realistic Raster-Based 3D Graphics
      Recipe 5.7.  Creating 3D Buttons
      Recipe 5.8.  Using 3D Models in Flash Not Originally Created in Swift 3D
      Recipe 5.9.  Creating a 3D Product View from Multiple Angles
      Recipe 5.10.  Rendering Swift 3D Animations as Flash Video
      Recipe 5.11.  Adding 3D Graphics Without Leaving Flash
        Chapter 6.  Composing Images with Bitmaps and Masks
      Recipe 6.1.  Importing Bitmaps
      Recipe 6.2.  Editing Bitmaps
      Recipe 6.3.  Fitting Bitmaps Inside Shapes
      Recipe 6.4.  Converting Bitmaps to Vector Art
      Recipe 6.5.  Animating Bitmaps
      Recipe 6.6.  Optimizing Bitmaps for Export
      Recipe 6.7.  Using Bitmaps with Transparency
      Recipe 6.8.  Masking Page Elements
      Recipe 6.9.  Animating Masks
        Chapter 7.  Working with Text Basics
      Recipe 7.1.  Adding Static Text to the Stage
      Recipe 7.2.  Changing the Appearance of Text
      Recipe 7.3.  Making Text Follow a Curve
      Recipe 7.4.  Adding Drop Shadows to Text
      Recipe 7.5.  Changing the Width of Static Text Fields (Without Stretching the Text)
      Recipe 7.6.  Resizing Text Fields (Stretching the Text)
      Recipe 7.7.  Setting Margins, Indentation, and Leading
      Recipe 7.8.  Setting Space Between Characters
      Recipe 7.9.  Optimizing Static Text for Minimum File Size
      Recipe 7.10.  Superscripting and Subscripting Characters
      Recipe 7.11.  Making Text Nonselectable
      Recipe 7.12.  Creating Text Hyperlinks
      Recipe 7.13.  Adding an Email Link to Static Text
      Recipe 7.14.  Opening Browser Windows with Specific Parameters Using Static Text
      Recipe 7.15.  Calling ActionScript Functions from Static Text
      Recipe 7.16.  Making Small Fonts Readable
      Recipe 7.17.  Checking Spelling
        Chapter 8.  Working with Dynamic Text
      Recipe 8.1.  Creating Text that You Can Modify at Runtime
      Recipe 8.2.  Changing Text at Runtime
      Recipe 8.3.  Accepting User Input
      Recipe 8.4.  Accepting Password Input
      Recipe 8.5.  Limiting the Length of User Input
      Recipe 8.6.  Setting Allowable Characters for Input
      Recipe 8.7.  Retrieving User Input
      Recipe 8.8.  Resizing Dynamic or Input Text Fields
      Recipe 8.9.  Creating Multiline Text
      Recipe 8.10.  Creating Scrolling Text
      Recipe 8.11.  Specifying Wrapping of Multiline Fields
      Recipe 8.12.  Using HTML Tags in Text
      Recipe 8.13.  Entering International and Nonstandard Characters
      Recipe 8.14.  Ensuring that Text Displays in the Original Font
      Recipe 8.15.  Applying CSS
        Chapter 9.  Adding Interactivity
      Recipe 9.1.  Creating Buttons from Scratch
      Recipe 9.2.  Creating Buttons that Animate
      Recipe 9.3.  Defining the Area that Activates the Button
      Recipe 9.4.  Creating Hotspots with Invisible Buttons
      Recipe 9.5.  Making Buttons Respond to Clicks
      Recipe 9.6.  Making Buttons Respond to Mouse Rollovers
      Recipe 9.7.  Making Buttons Respond to Dragging and Releasing Off the Instance
      Recipe 9.8.  Building Menus with Buttons
      Recipe 9.9.  Using Slider Controls
      Recipe 9.10.  Using a Dial Control
      Recipe 9.11.  Creating Custom Cursors
      Recipe 9.12.  Creating Animated Cursors
      Recipe 9.13.  Creating Interactive Custom Cursors
      Recipe 9.14.  Hiding the Hand Cursor
      Recipe 9.15.  Detecting Keystrokes
        Chapter 10.  Managing Playback
      Recipe 10.1.  Pausing a Movie After It Loads
      Recipe 10.2.  Preventing the Movie from Looping
      Recipe 10.3.  Dividing the Timeline into Segments
      Recipe 10.4.  Skipping the Playhead to a Different Frame of the Timeline
      Recipe 10.5.  Creating a Basic Interface to Control Timeline Playback
      Recipe 10.6.  Playing the Timeline Backward
      Recipe 10.7.  Creating Seek Buttons
        Chapter 11.  Managing Movie Clips
      Recipe 11.1.  Performing Actions Repeatedly Over Time
      Recipe 11.2.  Applying Transparency to Movie Clips
      Recipe 11.3.  Fading Movie Clip Instances In and Out
      Recipe 11.4.  Adjusting Movie Clip Instance Color
      Recipe 11.5.  Animating Color Changes
      Recipe 11.6.  Brightening Movie Clip Instances
      Recipe 11.7.  Transforming Movie Clips (Rotation, Scaling, and Skewing)
      Recipe 11.8.  Moving a Movie Clip in Front of or Behind Another Movie Clip (or a Button or Text Field)
      Recipe 11.9.  Creating New Movie Clips Based on Existing Movie Clips
      Recipe 11.10.  Generating Unique Depths
      Recipe 11.11.  Controlling Movie Clip Playback from Different Timelines
      Recipe 11.12.  Creating Simple Drag-and-Drop Functionality
      Recipe 11.13.  Constraining Drag-and-Drop Areas
      Recipe 11.14.  Changing Movie Clip Visibility
      Recipe 11.15.  Relocating or Moving Movie Clips
      Recipe 11.16.  Detecting Collisions (or Overlaps) Between Two Movie Clips
      Recipe 11.17.  Adding Movie Clips at Runtime
        Chapter 12.  Creating Presentations and Slideshows
      Recipe 12.1.  Building a Presentation Using the Built-in Template
      Recipe 12.2.  Building a Presentation Using a Slide Presentation
      Recipe 12.3.  Adding Back and Forward Buttons to a Slide Presentation
      Recipe 12.4.  Adding Transitions to Slide Presentations
      Recipe 12.5.  Building a Presentation Using the Flash 8 Cookbook Components
      Recipe 12.6.  Adding Buttons to a Presentation Using Flash 8 Cookbook Components
      Recipe 12.7.  Adding Transition Effects to a Presentation Using the Flash 8 Cookbook Components
      Recipe 12.8.  Building an Image Slideshow Using a Flash Template
      Recipe 12.9.  Building an Image Slideshow Using the Flash 8 Cookbook Components
      Recipe 12.10.  Adding Titles and Captions to a Slideshow Using the Flash 8 Cookbook Components
        Chapter 13.  Building Flash Forms
      Recipe 13.1.  Adding a Form Control for Gathering Text Information
      Recipe 13.2.  Adding a Password Form Control
      Recipe 13.3.  Adding a Menu Form Control
      Recipe 13.4.  Adding a Checkbox Form Control
      Recipe 13.5.  Adding a Radio Button Form Control
      Recipe 13.6.  Adding a Form Control for Gathering Numeric Input
      Recipe 13.7.  Adding a Clickable Button
      Recipe 13.8.  Adding a Button that Can Toggle
      Recipe 13.9.  Adding a Form Control for Collecting Date Information
      Recipe 13.10.  Performing Actions When the User Clicks a Button
      Recipe 13.11.  Retrieving Text Field, Text Input, and Text Area Values
      Recipe 13.12.  Retrieving Combo Box, Single-Select List, and Numeric Stepper Values
      Recipe 13.13.  Retrieving Values from Multiselect Lists
      Recipe 13.14.  Retrieving Values from Checkboxes and Toggle Buttons
      Recipe 13.15.  Retrieving Values from Radio Button Groups
      Recipe 13.16.  Retrieving Date Values
      Recipe 13.17.  Submitting Form Data to the Server
      Recipe 13.18.  A Feedback Form
        Chapter 14.  Building Advanced Flash Forms
      Recipe 14.1.  Performing Actions When the User Clicks a Checkbox or Radio Button
      Recipe 14.2.  Performing Actions When the User Makes a Date Selection
      Recipe 14.3.  Creating a Jump Menu
      Recipe 14.4.  Preselecting Date Control Values
      Recipe 14.5.  Preselecting Menu Control Values
      Recipe 14.6.  Validating Form Data
        Chapter 15.  Customizing UI Components
      Recipe 15.1.  Applying Individual Component Styles
      Recipe 15.2.  Applying Styles to Component Groups
      Recipe 15.3.  Applying Styles to Component Types
      Recipe 15.4.  Applying Styles Globally
      Recipe 15.5.  Working with Color Styles
      Recipe 15.6.  Working with Font and Text Styles
      Recipe 15.7.  Working with Border and Background Styles
      Recipe 15.8.  Working with Button and Scrollbar Styles
      Recipe 15.9.  Working with List Styles
      Recipe 15.10.  Working with Combo Box Styles
      Recipe 15.11.  Working with Radio Button, Checkbox, and Arrow Styles
      Recipe 15.12.  Using Different Artwork Themes
        Chapter 16.  Loading Images and Flash Content
      Recipe 16.1.  Loading External SWF/Image Content
      Recipe 16.2.  Loading External SWF/JPEG Content into a Draggable Window
      Recipe 16.3.  Loading External SWF/JPEG Content into a Scroll Pane
      Recipe 16.4.  Determining Load Progress
      Recipe 16.5.  Hiding a Progress Bar When Content Has Loaded
      Recipe 16.6.  Optimizing Download Time by Sharing Content Among Movies
        Chapter 17.  Working with Sound
      Recipe 17.1.  Importing Sounds
      Recipe 17.2.  Updating Imported Sounds (When the Source File Has Been Modified)
      Recipe 17.3.  Adding a Sound to a Timeline for Playback
      Recipe 17.4.  Synchronizing Sounds to Animation
      Recipe 17.5.  Playing a Sound with a Button
      Recipe 17.6.  Applying Effects to Sounds
      Recipe 17.7.  Changing the In and Out Points of a Sound
      Recipe 17.8.  Looping Sounds
      Recipe 17.9.  Compressing Sounds in Your Movie (Optimizing Quality and File Size)
      Recipe 17.10.  Starting and Stopping Sounds with Buttons
      Recipe 17.11.  Stopping All Sounds
      Recipe 17.12.  Manually Synchronizing Sounds and Visuals
        Chapter 18.  Working with Video
      Recipe 18.1.  Encoding Video
      Recipe 18.2.  Deploying Video
      Recipe 18.3.  Playing Flash Video
      Recipe 18.4.  Customizing the FLVPlayback Component
      Recipe 18.5.  Adding Cue Points/Captions
      Recipe 18.6.  Detecting Bandwidth
      Recipe 18.7.  Optimizing Video Playback
        Chapter 19.  Using Data
      Recipe 19.1.  Loading Variables
      Recipe 19.2.  Sending Variables
      Recipe 19.3.  Loading Text
      Recipe 19.4.  Loading XML Data with Components
      Recipe 19.5.  Calling Web Service Methods with Components
      Recipe 19.6.  Calling Flash Remoting Methods with Components
      Recipe 19.7.  Displaying Data with Components
      Recipe 19.8.  Formatting Data with Data Binding
      Recipe 19.9.  Sending Data Using Data Binding
        Chapter 20.  Building Preloaders
      Recipe 20.1.  Determining How a Movie Will Download
      Recipe 20.2.  Building a Simple Preloader
      Recipe 20.3.  Building a Preloader that Displays Load Percentage
      Recipe 20.4.  Using a Progress Bar to Create a Graphical Preloader
      Recipe 20.5.  Creating Preloaders for Files with Exported Symbols
      Recipe 20.6.  Creating Preloaders for Files with Components
        Chapter 21.  Publishing Flash
      Recipe 21.1.  Publishing Flash to the Browser
      Recipe 21.2.  Making Flash Content that Works with DHTML Menus
      Recipe 21.3.  Detecting Flash Player Version
      Recipe 21.4.  Passing Parameters to Flash from HTML
      Recipe 21.5.  Communicating Between Flash and JavaScript
      Recipe 21.6.  Integrating Flash with the Browser Back Button
      Recipe 21.7.  Publishing Projectors
      Recipe 21.8.  Making Fullscreen Flash Projectors
      Recipe 21.9.  Printing Flash Content
      Recipe 21.10.  Hiding the Context Menus
        Chapter 22.  Deploying Flash on Mobile Devices
      Recipe 22.1.  Creating a Flash Lite Movie
      Recipe 22.2.  Using the Mobile Emulator
      Recipe 22.3.  Finding Supported Devices
      Recipe 22.4.  Playing a Flash Lite Movie on a Device
      Recipe 22.5.  User Navigation for Flash Lite
      Recipe 22.6.  Overriding the Default Active Button State
      Recipe 22.7.  Applying Custom Labels to the Soft Keys
      Recipe 22.8.  Responding to the Soft Keys
      Recipe 22.9.  Accessing External Data
      Recipe 22.10.  ActionScript for Flash Lite
      Recipe 22.11.  Using Sound in Flash Lite
      Recipe 22.12.  The Flash Lite Development Community
        Chapter 23.  Making Movies Accessible
      Recipe 23.1.  Detecting and Redirecting Users with Assistive Devices
      Recipe 23.2.  Making Content Accessible
      Recipe 23.3.  Making Animated, Interactive, and Visually Complex Movies Accessible
      Recipe 23.4.  Creating Accessible Buttons
      Recipe 23.5.  Making Keyboard-Navigable Movies
      Recipe 23.6.  Providing Captions
   About the Author