O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

ActionScript® 3.0 for Adobe® Flash® CS4 Professional Classroom in a Book®

Book Description

The fastest, easiest, most comprehensive way to learn ActionScript® 3.0 for Adobe Flash CS4 Professional

ActionScript® 3.0 for Adobe Flash CS4 Professional Classroom in a Book contains 14 lessons. The book covers the basics of learning ActionScript and provides countless tips and techniques to help you become more productive. You can follow the book from start to finish or choose only those lessons that interest you.

Learn to add interactivity to Flash files using ActionScript 3.0: Control timelines and animation, write event-handling functions, and control loading of and interaction with data, text, video, sound, and images.

“The Classroom in a Book series is by far the best training material on the market. Everything you need to master the software is included: clear explanations of each lesson, step-by-step instructions, and the project files for the students.” —Barbara Binder, Adobe Certified Instructor, Rocky Mountain Training

Classroom in a Book®, the best-selling series of hands-on software training workbooks, helps you learn the features of Adobe software quickly and easily. Classroom in a Book offers what no other book or training program does—an official training series from Adobe Systems Incorporated, developed with the support of Adobe product experts.

Table of Contents

  1. Copyright
  2. What’s on the Disc
    1. Lesson files ... and so much more
  3. Getting Started
    1. About Classroom in a Book
    2. Prerequisites
    3. Installing Flash
    4. Optimizing performance
    5. Copying the lesson files
    6. How to use these lessons
    7. Standard elements in the book
    8. Additional resources
    9. Finding resources for using ActionScript
    10. Checking for updates
    11. Flash Player version
    12. For users of Flash CS3
    13. Adobe certification
  4. Introduction to ActionScript 3.0
    1. A brief history of Flash and ActionScript
    2. ActionScript 3.0 for new programmers
    3. For users of ActionScript 1.0 and 2.0
      1. First the bad news
      2. ...and now the good news
      3. Formats for playing back Flash and ActionScript 3.0 files
      4. Flash and Flex
      5. ActionScript in the Flash timeline vs. external ActionScript files
      6. That’s enough background for now...
  5. 1. Navigating the Flash Timeline
    1. Getting started
    2. Placing code on the Flash timeline
      1. Working with labels
      2. Looping playback with ActionScript
        1. Creating looping animation
      3. Keeping track of the number of loops
        1. Creating a count variable
        2. Updating the count variable
        3. Displaying the count in a text field
      4. Using a conditional statement to control the timeline
        1. Updating the text on the home frame
    3. Some suggestions to try on your own
    4. Review questions
    5. Review answers
  6. 2. Working with Events and Functions
    1. Creating event listeners and event handling functions
    2. Creating navigation with a button click
      1. Creating button instances for controlling navigation
      2. Adding functions to respond to button clicks
      3. Adding a restart button
      4. Adding to the dynamic text field
      5. Adding buttons to control language
    3. Some suggestions to try on your own
    4. Review questions
    5. Review answers
  7. 3. Creating Animation with ActionScript
    1. Reviewing the starting file
    2. Controlling MovieClip properties with ActionScript
      1. Changing a property value
      2. Increasing or decreasing a property’s value
      3. Using an ENTER_FRAME event to animate a MovieClip property
      4. Creating a variable to store a MovieClip reference
      5. Changing MovieClip properties with buttons
    3. Creating animation using ActionScript tweens
      1. Importing the Tween and easing classes
      2. Adding ActionScript tweens
    4. Some suggestions to try on your own
    5. Review questions
    6. Review answers
  8. 4. Creating ActionScript in External Files
    1. Creating an ActionScript file
      1. Creating a basic ActionScript file in Flash
      2. Basic structure of an ActionScript 3.0 class file
    2. Creating instances of a class file in Flash
      1. Overriding the parameters of each Ellipse instance
      2. Turning the makeShapes() function on and off
      3. Randomizing the color of the ellipses
    3. Some suggestions to try on your own
    4. Review questions
    5. Review answers
  9. 5. Using ActionScript and Components to Load Content
    1. Creating an instance of the List component and setting its parameters
    2. Adding an instance of the UILoader component
    3. Adding a CHANGE event listener to the List component
    4. Loading SWF files into a UILoader component
    5. Creating the gallery file
      1. Examining the gallery.fla file
      2. Adding event listeners to the thumbnails
      3. Loading text from an external file
        1. Using the COMPLETE event to confirm loading external text
    6. Adding a scroll bar to the text field
    7. Some suggestions to try on your own
    8. Review questions
    9. Review answers
  10. 6. Creating Preloaders in ActionScript 3.0
    1. Tools in the testing environment
      1. Bandwidth Profiler
      2. Simulate Download
    2. Creating a text field and progress bar to track loading
    3. Inserting ActionScript to track progress of the UILoader component
      1. Adding event listeners for PROGRESS and COMPLETE
      2. Creating the progressHandler() function
      3. Adding the completeHandler() function
    4. Controlling the frames of a MovieClip to reflect loading progress
      1. Adding ActionScript for the loadAnimation clip
    5. Some suggestions to try on your own
    6. Review questions
    7. Review answers
  11. 7. Using Arrays and Loops in ActionScript 3.0
    1. Examining the starting file
    2. Adding MovieClip instances to the stage from the Library
      1. Setting the linkage properties of a MovieClip
      2. Adding a new instance of the Block class to the stage
    3. Generating multiple instances with a for loop
      1. Creating the for loop
      2. Modifying a for loop’s behavior with variables
    4. Adding event listeners to the Block instances
    5. Creating animation using ENTER_FRAME
      1. Adding the ENTER_FRAME listener
      2. Using an event’s target property
      3. Creating the rotateUp() function
      4. Adding an else statement
    6. Adding the testDone() function
      1. Introducing the array
      2. Using the push() method
      3. Checking the properties of elements in the rArray
    7. Some suggestions to try on your own
    8. Review questions
    9. Review answers
  12. 8. Creating a Radio Button Quiz in an ActionScript File
    1. Examining the starting file
    2. Creating a new ActionScript file
    3. Setting up the RadioButtonQuiz class
      1. Importing classes into the RadioButtonQuiz class
      2. Creating the RadioButtonQuiz class
      3. Reviewing the format of the quiz
    4. Adding variables to the RadioButtonQuiz class
    5. Creating the quiz functionality
      1. Creating the constructor function
      2. Creating the quizInit() function
      3. Creating a RadioButtonGroup
    6. Formatting text with ActionScript
    7. Creating the quiz
      1. Creating the addQuestion() function
        1. Adding a switch statement
      2. Adding the setRadioButtons() method
        1. Calling the createRadioButton() method
        2. Creating the answers array
      3. Adding the createRadioButton() method
        1. Checking to see if a condition is false
    8. Creating checkAnswer()—the final function
      1. Calling a function in the timeline from a class file
    9. Integrating your new class into the Flash project
      1. Adding an instance of the RadioButtonQuiz class
      2. Adding the RadioButton to the library
    10. Some suggestions to try on your own
    11. Review questions
    12. Review answers
  13. 9. Controlling Sound with ActionScript
    1. Examining the starting file
    2. Adding sliders to the project
    3. The Sound, SoundChannel, and SoundTransform classes
      1. Creating Sound, SoundChannel, and SoundTransform instances
      2. Adding more variables
      3. Creating the songList array
    4. Setting the song titles using a for loop
      1. Modifying text fields with the replace() method
    5. Making the sliders invisible until needed
    6. Programming the buttons to select songs
      1. Adding event listeners to the song buttons
      2. Creating the chooseSong() function
        1. Creating a switch statement for the song selection
      3. Creating a Sound class instance and checking for existing instances
      4. Loading a sound into a Sound instance
      5. Creating the SoundChannel and SoundTransform instances
    7. Controlling the visibility of the volume and pan controls
    8. Adding a listener for the ID3 tags of an MP3 file
      1. Creating the id3Handler() function
      2. Adding the Artist and Album information
    9. Adding a text format object
    10. Adding the slider controls
      1. Adding the volumeChange() and panChange() functions
    11. Some suggestions to try on your own
    12. Review questions
    13. Review answers
  14. 10. Working with an XML Playlist
    1. Understanding the basic structure of an XML file
    2. Examining the starting file
    3. Replacing the songList array with an XML instance
      1. Creating new XML and URLLoader instances
    4. Loading an external playlist using the URLLoader class
    5. Responding to COMPLETE and IO_ERROR events
    6. Moving the event listeners into the xmlLoaded() function
      1. Creating the setSongs() function
      2. Accessing song title and artist from the XML data
      3. Setting the song clips’ title and artist fields
      4. Adding a call to the setSongs() function
    7. Updating the chooseSong() function
    8. Creating hyperlinks using XML data
    9. Navigating through the song list
      1. Updating the song buttons
    10. Some suggestions to try on your own
    11. Review questions
    12. Review answers
  15. 11. Using ActionScript and Components to Control Video
    1. Examining the Lesson11 folder contents
    2. Adding the FLVPlayback component
    3. Setting FLVPlayback properties in Flash
      1. Setting the FLVPlayback controls
      2. Setting skin color and transparency
    4. Adding ActionScript control of FLVPlayback properties
      1. Adding a slider to control transparency
      2. Adding the initial slider ActionScript
    5. Working with color
      1. Adding the ColorPicker component
      2. Setting the skinBackgroundColor
    6. Adding the FLVCaptioning component
      1. Examining the captions.xml file
      2. Adding the FLVCaptioning component
    7. Playing multiple video files from an XML playlist
      1. Examining the vidlist.xml file
      2. Adding a title text field
      3. Loading the vidlist.xml file with ActionScript
      4. Creating the xmlLoaded() function
      5. Creating the changeVid() function
    8. Using the full-screen publish settings
    9. Some suggestions to try on your own
    10. Review questions
    11. Review answers
  16. 12. Delving Deeper into Graphics and Animation with ActionScript
    1. Inverse kinematics in Flash CS4
      1. Viewing the IKSample file
      2. Switching between authortime and runtime IK
    2. Examining the starting files
    3. Working with IK animation in ActionScript
      1. Using the IKArmature and IKManager classes
      2. Using the IKMover class
      3. Adding an event listener to the snapshot_btn
      4. Adding the moveDown() function
      5. Coding the moveUp() function
    4. Creating Sound and SoundChannel instances
    5. Playing and stopping the sound effects
    6. Accessing the user’s webcam or video camera using ActionScript
      1. Using the getCamera() method
      2. Checking for the presence of a video camera
    7. Using the Bitmap and BitmapData classes
    8. Examining the Pixel Bender Toolkit
      1. Examining the PBFilter.as file
      2. Working with the PBFilter class
        1. Using the onstage interface elements to add filters
        2. Adding a function to the filter_btn
        3. Manipulating a filter parameter with the Slider
    9. Suggestions to try on your own
    10. Review questions
    11. Review answers
  17. 13. Printing and Sending Email with ActionScript
    1. Examining the starting file
    2. Adding a simple email link
    3. Sending email from Flash
      1. Sending values using the URLVariables class
      2. Setting textColor and backgroundColor
      3. Sending URLVariables to the PHP file
    4. Adding printing capabilities with the PrintJob class
      1. Capturing the current date and time with the Date class
      2. Creating the content to print
      3. Using try/catch statements in ActionScript
      4. ...and now to the printer
    5. Some suggestions to try on your own
    6. Review questions
    7. Review answers
  18. 14. Creating Adobe AIR Applications with Flash and ActionScript
    1. AIR-specific ActionScript
    2. Flash publish settings for an AIR project
      1. Setting the AIR descriptor file options
      2. Setting custom icons
      3. Creating a digital signature
    3. Including a file in the AIR application
    4. Creating an AIR application
    5. Examining the starting file
      1. A closer look at the ActionScript file
    6. Listening for drag events
      1. Using ClipboardFormats
      2. Adding the onDragDrop() function
      3. Looping through the file type arrays
    7. Some suggestions to try on your own
    8. Review questions
    9. Review answers
  19. Contributor
    1. Dedication
    2. Acknowledgments