Adobe
Products
Acrobat
Creative Cloud
Creative Suite
Digital Marketing Suite
Digital Publishing Suite
Elements
Photoshop
Touch Apps
Student and Teacher Editions
More products
Solutions
Creative tools for business
Digital marketing
Digital media
Education
Financial services
Government
Web Experience Management
More solutions
Learning Help Downloads Company
Buy
Home use for personal and home office
Education for students, educators, and staff
Business for small and medium businesses
Licensing programs for businesses, schools, and government
Special offers
Search
 
Info Sign in
Welcome,
My cart
My orders My Adobe
My Adobe
My orders
My information
My preferences
My products and services
Sign out
Why sign in? Sign in to manage your account and access trial downloads, product extensions, community areas, and more.
Adobe
Products Sections Buy   Search  
Solutions Company
Help Learning
Sign in Sign out My orders My Adobe
Preorder Estimated Availability Date. Your credit card will not be charged until the product is shipped. Estimated availability date is subject to change. Preorder Estimated Availability Date. Your credit card will not be charged until the product is ready to download. Estimated availability date is subject to change.
Qty:
Purchase requires verification of academic eligibility
Subtotal
Review and Checkout
Adobe Developer Connection / ActionScript Technology Center /

ActionScript 3 Cookbook excerpts: From custom classes to the rendering model

by Joey Lott, Darron Schall, Keith Peters

Joey Lott, Darron Schall, Keith Peters
  • O'Reilly Media

Created

19 February 2007

Page tools

Share on Facebook
Share on Twitter
Share on LinkedIn
Bookmark
Print
ActionScript arrays display list Flash Player Flash Professional Flex Builder OOP

Requirements

User level

Intermediate

Required products

  • Flash Professional CS3 (Download trial)
  • Flex Builder 2 (Download trial)

Well before Ajax and Microsoft Windows Presentation Foundation, Macromedia Flash provided the first method for building "rich" web pages. Now that Flash is a full-fledged development environment, learning ActionScript 3 is key—a challenge for even the most experienced Flash developer.

The following book excerpts include Chapters 1, 2, 3, 5, and 6 from ActionScript 3 Cookbook by Joey Lott, Darron Schall, and Keith Peters, published by O'Reilly Media. This book offers more than 300 solutions to solve a wide range of coding dilemmas so you can learn to work with the new version right away.

This book is written with all levels of ActionScript developers in mind—people like you who want practical solutions to common problems. It contains many accessible and practical examples, solutions, and insights into the situations that Flash and ActionScript developers are sure to encounter. Each recipe presents a problem, a solution, and a discussion of the solution. You can quickly locate the recipe that most closely matches your situation and get the solution without having to read the whole book to understand the underlying code. The book helps you understand the concepts by applying them in real situations. You'll even learn how to link modular ActionScript pieces together to create rock-solid solutions for Flex 2 and Flash applications.

The printed book is available through most major online and retail bookstores worldwide, and can be read online at Safari Books Online. For more information visit the O'Reilly store.

ActionScript 3 Cookbook © 2006 Joey Lott, Darron Schall, and Keith Peters. Reproduced by permission of O'Reilly Media Inc. All rights reserved.

ActionScript basics

Chapter 1 covers basic programming tasks such as using looping statements, timers, and more. It discusses the frequent goals and problems that relate to core usage. These recipes can help you handle situations that arise in every ActionScript 3 project. This chapter includes instructions on getting started with Flex Builder 2, setting up an ActionScript project, and writing code for your first application. It provides a useful glossary of terms and includes information on how to trace messages, handle events, and perform actions conditionally as well as outlining best practices for creating reusable code.

Download the complete chapter:

Chapter 1: ActionScript basics (PDF, 480K)

Custom classes

Chapter 2 dives into writing custom classes with ActionScript 3. The core focus of ActionScript 3 is using classes as building blocks. You can create packages to organize your custom classes into groups. When using Flex 2, all ActionScript code is placed within a class. This chapter provides invaluable information about how to name and save your custom classes, as well as creating subclasses, methods, and properties. It also covers how to dispatch events. Learning how to create custom classes is integral to ActionScript 3—and it's the next big step to expanding your application development skills.

Download the complete chapter:

Chapter 2: Custom classes (PDF, 244K)

Runtime environment

Chapter 3 takes an in-depth look at the runtime environment in Flash Player 9. This chapter covers how to get information about the operating system, device, and Flash Player version in use, as well as discussing important security functions. Ensure that your application appears as expected by programmatically detecting display settings and scaling the content. Change alignment of the SWF, determine the user's audio and video playback capabilities, and even prompt the user to change their Flash Player settings. This chapter also includes information related to loading external content into your application from another domain.

Download the complete chapter:

Chapter 3: Runtime environment (PDF, 268K)

Arrays

Chapter 5 discusses working with indexed collections of data, called arrays. Every aspect of using arrays is covered, from adding and removing elements to sorting. Arrays are very powerful and allow you to group related data together, which can then be accessed and displayed within your application when desired. This chapter describes both associative and integer-indexed arrays. ActionScript even allows you to store different data types in a single array—unlike other programming languages. This chapter can help you get started using arrays, including looping through an array, searching for matching elements, randomizing the elements in an array, and implementing custom sorting of data.

Download the complete chapter:

Chapter 5: Arrays (PDF, 404K)

Display list

Chapter 6 describes the new rendering model for ActionScript 3 and Flash Player 9—which differs radically from the previous versions. This chapter focuses on using display objects to control the visual data shown on the screen. The new rendering model is still hierarchical, but is much more flexible and uses the display list concept and the classes available in the flash.display package. Each SWF now contains one display list, which is comprised of three types of elements: the Stage, display object containers, and display objects. Transitioning to the display list offers many benefits for developers, including increased performance, easier depth management, and less rigid structure. It also provides a much simpler process for creating visual items programmatically.

Chapter 6: Display list (PDF, 528K)

More Like This

  • Top five misperceptions about ActionScript 3
  • ActionScript 3.0 Quick Reference Guide excerpts: Copy motion, display list, events, and migration
  • Handling audio file cue points in ActionScript 2 and ActionScript 3
  • Top five benefits of ActionScript
  • Tips for learning ActionScript 3.0
  • Introduction to event handling in ActionScript 3.0
  • Developers and designers talk about migrating to ActionScript 3
  • ActionScript 3.0 overview
  • ActionScript 3.0 from the ground up
  • Essential ActionScript 3 excerpt: Display and interactivity

Tutorials & Samples

Tutorials

  • Flash iOS Apps Cookbook excerpt: ActionScript optimization
  • Introduction to Robotlegs – Part 3
  • Introduction to Robotlegs – Part 2
  • Introduction to Robotlegs – Part 1

Samples

  • ActionScript 3 samples for Flash Professional CS5

ActionScript Blog

More
06/09/2012 New Flash Tools: Flash Optimizer 2.3
06/09/2012 Flash Optimizer 2.3
05/27/2012 How to add an image to android gallery (CameraRoll) using adobe air
04/22/2012 ActionScript 3.0 BitmapData, Clone, and ColorTransform

ActionScript Cookbook

More
03/20/2012 PDF Portfolio Navigational TOC
02/29/2012 Embed Stage3D content inside Flex application components
02/13/2012 Randomize an array
02/09/2012 Using Camera with a MediaContainer instead of VideoDisplay

Products

  • Acrobat
  • Creative Cloud
  • Creative Suite
  • Digital Marketing Suite
  • Digital Publishing Suite
  • Elements
  • Mobile Apps
  • Photoshop
  • Touch Apps
  • Student and Teacher Editions

Solutions

  • Digital marketing
  • Digital media
  • Web Experience Management

Industries

  • Education
  • Financial services
  • Government

Help

  • Product help centers
  • Orders and returns
  • Downloading and installing
  • My Adobe

Learning

  • Adobe Developer Connection
  • Adobe TV
  • Training and certification
  • Forums
  • Design Center

Ways to buy

  • For personal and home office
  • For students, educators, and staff
  • For small and medium businesses
  • For businesses, schools, and government
  • Special offers

Downloads

  • Adobe Reader
  • Adobe Flash Player
  • Adobe AIR
  • Adobe Shockwave Player

Company

  • News room
  • Partner programs
  • Corporate social responsibility
  • Career opportunities
  • Investor Relations
  • Events
  • Legal
  • Security
  • Contact Adobe
Choose your region United States (Change)
Choose your region Close

North America

Europe, Middle East and Africa

Asia Pacific

  • Canada - English
  • Canada - Français
  • Latinoamérica
  • México
  • United States

South America

  • Brasil
  • Africa - English
  • Österreich - Deutsch
  • Belgium - English
  • Belgique - Français
  • België - Nederlands
  • България
  • Hrvatska
  • Česká republika
  • Danmark
  • Eastern Europe - English
  • Eesti
  • Suomi
  • France
  • Deutschland
  • Magyarország
  • Ireland
  • Israel - English
  • ישראל - עברית
  • Italia
  • Latvija
  • Lietuva
  • Luxembourg - Deutsch
  • Luxembourg - English
  • Luxembourg - Français
  • الشرق الأوسط وشمال أفريقيا - اللغة العربية
  • Middle East and North Africa - English
  • Moyen-Orient et Afrique du Nord - Français
  • Nederland
  • Norge
  • Polska
  • Portugal
  • România
  • Россия
  • Srbija
  • Slovensko
  • Slovenija
  • España
  • Sverige
  • Schweiz - Deutsch
  • Suisse - Français
  • Svizzera - Italiano
  • Türkiye
  • Україна
  • United Kingdom
  • Australia
  • 中国
  • 中國香港特別行政區
  • Hong Kong S.A.R. of China
  • India - English
  • 日本
  • 한국
  • New Zealand
  • 台灣

Southeast Asia

  • Includes Indonesia, Malaysia, Philippines, Singapore, Thailand, and Vietnam - English

Copyright © 2012 Adobe Systems Incorporated. All rights reserved.

Terms of Use | Privacy Policy and Cookies (Updated)

Ad Choices

Reviewed by TRUSTe: site privacy statement