Macromedia® Flash™ MX 2004 ActionScript: Training from the Source

Book description

Sure, you can use Flash MX 2004 without being a master programmer, but as any Flash developer worth his or her salt will tell you, you're not tapping all of its power unless you're taking advantage of its scripting language "ActionScript 2.0" which offers a more robust programming model and better object-oriented programming support than ever before. Here to take the fear factor out of learning it are Flash veterans and best-selling authors Derek Franklin and Jobe Makar, who demonstrate that scripting is an instinctual process you already know by translating real-life activities into ActionScript scripts. In these pages, you'll find methodologies and techniques for building over 40 real-life Flash ActionScript projects, including sample games, --- applications, Web sites, and more. New in this edition are coverage of ActionScript 2.0, Web services, Components, Printing, Video, and more. On the companion CD, you'll find all the project files and images you need to complete each project.

Table of contents

  1. Copyright
    1. Dedication
  2. Bio
  3. Acknowledgments
  4. introduction
    1. Macromedia Training from the Source
    2. Macromedia Authorized Training and Certification
    3. What You Will Learn in This Book
    4. Minimum System Requirements
  5. 1. Introducing ActionScript
    1. ActionScript Matures to Version 2.0
    2. Differences Between ActionScript 1.0 and 2.0
      1. Case Sensitivity
      2. Strict Data Typing
      3. Class Structure
    3. Similarities Between Actionscript 1.0 and 2.0
    4. Why Learn ActionScript?
    5. ActionScript Elements
      1. Events
      2. Actions
      3. Operators
      4. Keywords
      5. Data
      6. Curly Braces
      7. Semicolons
      8. Dot Syntax
      9. Parentheses
      10. Quotation Marks
      11. Comments
      12. Indenting/Spacing
    6. Using the Actions Panel/ActionScript Editor
    7. Planning a Project
      1. What do you want to occur?
      2. What pieces of data do you need to track?
      3. What needs to happen in the movie prior to a script being triggered?
      4. What event will trigger the main script?
      5. Are there decisions to be made when the main script is triggered?
      6. What elements make up the scene? How do they function?
      7. What will your scene look like?
    8. Writing Your First Script
    9. Testing Your First Script
    10. What You Have Learned
  6. 2. Using Event Handlers
    1. What Event Handlers Do
    2. Choosing the Right Event Handler
    3. Using Mouse Events
      1. Making Contact: on (press)
      2. Letting Go: on (release)
      3. Pulling, Snapping: on (releaseOutside)
      4. Keyboard Control: on (keyPress)
      5. Over But Not Touching: on (rollOver)
      6. No Longer On Top Of: on (rollOut)
      7. Grooves, Bumps, Rubbing: on (dragOver)
      8. Oops: on (dragOut)
    4. Making the Most of Attaching Mouse Events to Movie Clips
    5. Using Frame Events
    6. Using Clip Events
      1. Presence: onClipEvent (load)
      2. Absence: onClipEvent (unLoad)
      3. Power, Energy: onClipEvent (enterFrame)
      4. Movement: onClipEvent (mouseMove)
      5. Computer-Based Interaction: onClipEvent (mouseDown), onClipEvent (mouseUp), onClipEvent (keyDown), onClipEvent (keyUp)
      6. Receiving Instructions: onClipEvent (data)
    7. Orchestrating Multiple Events
    8. Understanding Event Handler Methods
    9. Using Event Handler Methods
    10. Using Listeners
    11. What You Have Learned
  7. 3. Understanding Target Paths
    1. Understanding Multiple Timelines
    2. Targeting the Current Movie
    3. Targeting the Main Movie
    4. Targeting a Parent Movie
    5. Targeting Movie Clip Instances
    6. Targeting Movies on Levels
    7. Targeting Movie Clip Instances on Levels
    8. Understanding Multiple Identities
    9. Creating and Referencing Global Elements
    10. What You Have Learned
  8. 4. Using Object Classes
    1. What Objects are and Why They're Useful
      1. Understanding the Concept of Object Classes
      2. Properties
      3. Methods
    2. Built-In Object Classes
      1. Accessibility Class (Top-Level)
      2. Array Class (Instances)
      3. Boolean Class (Instances)
      4. Button Class (Instances)
      5. Capabilities Class (Top-Level)
      6. Color Class (Instances)
      7. ContextMenu Class (Instances)
      8. ContextMenuItems Class (Instances)
      9. Date Class (Instances)
      10. Error Class (Instances)
      11. Key Class (Top-Level)
      12. LoadVars Class (Instances)
      13. Math Class (Top-Level)
      14. Mouse Class (Top-Level)
      15. MovieClip Class (Instances)
      16. MovieClipLoader Class (Instances)
      17. NetConnection Class (Instances)
      18. NetStream Class (Instances)
      19. Number Class (Top-Level)
      20. Object Class (Instances)
      21. PrintJob Class (Instances)
      22. Selection Class (Top-Level)
      23. Sound Class (Instances)
      24. Stage Class (Top-Level)
      25. String Class (Instances)
      26. StyleSheet Class (Instances)
      27. System Class (Top-Level)
      28. TextField Class (Instances)
      29. TextFormat Class (Instances)
      30. XML Class (Instances)
      31. XMLSocket Class (Instances)
    3. Using the Color Class
    4. Using the Key Class to Add Interactivity
    5. Working with String and Selection Classes
    6. What You Have Learned
  9. 5. Using Functions
    1. Creating Functions
      1. Syntax 1
      2. Syntax 2
    2. Adding Parameters to Functions
    3. Using Local Variables and Creating Functions that Return Results
      1. Returning Results from a Function Call
    4. What You Have Learned
  10. 6. Creating and Manipulating Data
    1. Creating Variables
    2. Creating Arrays
    3. Creating Dynamic Text Fields and Retrieving Information
    4. Retrieving the Data
    5. Building Expressions
    6. Operators
      1. Arithmetic Operators
      2. String Operators
      3. Precedence
    7. Manipulating Numerical Data Using Math
    8. Manipulating Strings
    9. What You Have Learned
  11. 7. Creating Custom Classes
    1. Classes, Top-Level Classes, and Instances
    2. Creating a Class
    3. The Classpath
      1. The Global Classpath
      2. The Document-Level Classpath
    4. Packages and Importing Classes
    5. Getters and Setters
      1. Implicit get and set Methods
    6. Defining Members
      1. Public and Private Members
      2. Static Members
    7. Understanding Inheritance
    8. What You Have Learned
  12. 8. Using Conditional Logic
    1. Controlling a Script's Flow
      1. If/Then Statements
      2. If/Else If Statements
      3. If/Else Statements
      4. Conditional Statement Variations
    2. Determining Conditions
    3. Reacting to Multiple Conditions
    4. Defining a Boundary
    5. Turning Power On/Off
    6. Reacting to User Interaction
    7. Detecting Collisions
    8. What You Have Learned
  13. 9. Automating Scripts with Loops
    1. Why Loops Are Useful
    2. Types of Loops
      1. while Loop
      2. for Loop
      3. for…in Loop
    3. Writing and Understanding Loop Conditions
    4. Nested Loops
    5. Loop Exceptions
    6. What You Have Learned
  14. 10. Scripting UI Components
    1. Components: A Scripting Primer
    2. Configuring Component Properties
      1. Common Properties
      2. Component-Specific Properties
    3. Triggering Scripts Using Component Events
      1. Common Events
      2. Component-Specific Events
      3. Handling Events
    4. Using Component Methods
      1. Common Methods
      2. Component-Specific Methods
    5. Using The FocusManager Component
      1. Scenario 1
      2. Scenario 2
    6. Customizing UI Components With ActionScript
    7. What You Have Learned
  15. 11. Getting Data In and Out of Flash
    1. Understanding Data Sources and Data Formats
    2. GET vs. POST
    3. Using The LoadVars Class
    4. Policy Files
    5. Using Shared Objects
    6. Using the WebServiceConnector Component
    7. What You Have Learned
  16. 12. Using XML with Flash
    1. XML Basics
    2. Using the XML Class
      1. Formatting XML
      2. Parsing XML
      3. Loading XML
      4. Sending XML
    3. Using Socket Servers
      1. Introduction to the XMLSocket Class
      2. ElectroServer 3
      3. The ElectroServer Class
    4. What You Have Learned
  17. 13. Validating Data
    1. The Logic Behind Validating Data
    2. Using Validation Routines
    3. Handling Errors
    4. Validating Strings
    5. Validating Sequences
    6. Validating Against a List of Choices
    7. Validating Numbers
    8. Processing Validated Data
    9. What You Have Learned
  18. 14. Working with Text Fields
    1. Dynamically Creating and Configuring Text Fields
    2. Using TextFormat Objects
    3. Loading and Communicating with Inline Images and SWFs
    4. Formatting Text Fields with Cascading Style Sheets
    5. What You Have Learned
  19. 15. Controlling Movie Clips Dynamically
    1. Creating Movie Clip Instances Dynamically
      1. Using duplicateMovieClip()
      2. Using attachMovie()
      3. Using createEmptyMovieClip()
      4. Using attachMovie()
    2. Building Continuous-Feedback Buttons
    3. Using Actionscript to Draw Lines Dynamically
      1. Using lineStyle()
      2. Using moveTo()
      3. Using lineTo()
    4. Using the Drawing Methods
    5. Creating Filled Shapes Dynamically
    6. Z-Sorting Movie Clip Instances
    7. Dragging and Dropping Movie Clip Instances
    8. Removing Dynamically Created Content
    9. What You Have Learned
  20. 16. Time- and Frame-Based Dynamism
    1. The Use of Time in Flash
    2. Working with Dates in Flash
      1. Using the DateChooser Component
    3. Determining the Passage of Time
    4. Controlling the Playback Speed and Direction of a Timeline
    5. Tracking Playback and Downloading Progression
    6. What You Have Learned
  21. 17. Scripting for Sound
    1. Controlling Sound with ActionScript
    2. Creating a Sound Object
    3. Dragging a Movie Clip Instance within a Boundary
    4. Controlling Volume
    5. Controlling Panning
    6. Attaching Sounds and Controlling Sound Playback
    7. What You Have Learned
  22. 18. Loading External Assets
    1. The Ins and Outs of Loading External Assets
    2. Loading Movies into Targets
    3. Loading JPGs Dynamically
    4. Creating an Interactive Placeholder
    5. Loading Movies into Levels
    6. Controlling a Movie on a Level
    7. Loading MP3s Dynamically
    8. Reacting to Dynamically Loaded MP3s
    9. Extracting ID3 Data From an MP3 File
    10. Loading and Controlling External Video
    11. What You Have Learned
  23. 19. Testing and Debugging
    1. Eliminating Bugs Before They Hatch
    2. Maximizing the Testing and Debugging Process
    3. Fixing Compile-Time Bugs
    4. Finding and Fixing Run-Time Bugs
      1. Using the trace() action
      2. Using the Debugger
      3. Setting and Using Breakpoints
      4. Remote Debugging
    5. What You Have Learned
  24. 20. Maximum-Strength SWFs
    1. Understanding and Using fscommand()
      1. Controlling the Standalone Flash Player (Projectors)
      2. Executing Applescripts with Fscommands
      3. Communicating with a Web Browser
      4. Creating an Enhanced Executable (Projector)
    2. Using Flash Studio Pro
    3. Using FlashVars
    4. What You Have Learned
  25. 21. Printing and Context Menus
    1. Flash Printing versus Browser Printing
    2. Using the PrintJob Class
    3. Creating Custom Context Menus
    4. What You Have Learned
  26. Licensing Agreement

Product information

  • Title: Macromedia® Flash™ MX 2004 ActionScript: Training from the Source
  • Author(s): Derek Franklin, Jobe Makar
  • Release date: November 2003
  • Publisher(s): Adobe Press
  • ISBN: 9780321213433