Advanced ActionScript 3 with Design Patterns

Book description

Today's ActionScript-based applications require increasingly sophisticated architectures and code. This book aids intermediate and advanced ActionScript developers in  learning how to plan and build applications more effectively. You'll learn how to apply design patterns as solutions to common programming scenarios. Beyond a reference, Advanced ActionScript with Design Patterns is a practical guide complete with sample mini-applications illustrating each design pattern.

Table of Contents:

Part I - Successful Projects
1. How to Design Applications
   
2. Programming to Interfaces
   
Part II - Patterns

3. MVC
   
4. Singleton
   
5. Factory (Abstract Factory and Factory Method)
   
6. Proxy
   
7. Iterator
   
8. Composite
   
9. Decorator
   
10. Command
   
11. Memento
   
12. State
   
Part III - Advanced ActionScript Topics

13. Working with Events
   
14. Sending and Loading Data
   
15. E4X (XML)
   
16. Regular Expressions


Table of contents

  1. Copyright
    1. Dedication
  2. Acknowledgments
  3. Introduction
    1. About This Book
  4. I. Successful Projects
    1. 1. Designing Applications
      1. The Analysis Phase
        1. Introducing Use Cases
        2. Writing Formal Use Cases
        3. Forming Use Cases
        4. Using UML in Analysis
      2. The Design Phase
        1. Introducing CRC Cards
        2. Determining Classes
        3. Determining Class Responsibilities
        4. Determining Collaborators
        5. Elaborating on Relationships Between Classes
          1. The Association Relationship
          2. The Aggregation Relationship
          3. The Inheritance Relationship
        6. Formalizing Public APIs
        7. Using UML for Design
      3. The Implementation Phase
        1. Coding Conventions
          1. Variables and Functions
          2. Constants
          3. Classes and Interfaces
          4. Packages
        2. Encapsulation
          1. Public Properties
          2. External References
          3. Designing for Encapsulation
        3. Inheritance and Composition
          1. Advantages and Disadvantages of Inheritance
          2. Advantages and Disadvantages of Composition
          3. Which to Use: Inheritance or Composition
        4. Coupling
      4. Testing
        1. Creating Basic Unit Tests
          1. Writing Test Cases
          2. Writing a Test Runner
        2. Creating Asynchronous Unit Tests
      5. Summary
    2. 2. Programming to Interfaces
      1. Defining Interfaces
        1. Interfaces Defined by Interface Constructs
        2. Interfaces Defined by Inheritance
        3. Deciding How to Define an Interface
      2. Using Polymorphism
        1. Differentiating Between Type and Class
        2. Making Runtime Decisions
      3. Summary
  5. II. Patterns
    1. 3. Model View Controller Pattern
      1. Understanding MVC Elements
        1. The Model
        2. The View
        3. The Controller
        4. The Relationships between Elements
      2. Building a Simple Example
        1. Clock Data Model
        2. Analog Clock View
        3. Testing the Analog Clock
        4. Digital Clock View
        5. Testing the Digital Clock
      3. Enabling Multiple Views for One Model
      4. Modifying Model Implementation
      5. Adding A Controller
      6. Summary
    2. 4. Singleton Pattern
      1. Object Instantiation
        1. Restricting Instantiation
        2. Single Instance and Global Access
      2. Singleton Versus Static Members
      3. Building a Simple Singleton
        1. Creating the Singleton
        2. Invoking the Singleton
      4. Building a Settings Framework
        1. Creating the XML Document
        2. Creating the Settings Class
        3. Invoking the Settings Class
      5. Summary
    3. 5. Factory and Template Method Patterns
      1. Abstract Classes
      2. Template Method
      3. Factory Method
      4. Summary
    4. 6. Proxy Pattern
      1. Virtual Proxy
        1. Image Loader Example
          1. Loading the Image
          2. Modifying the Image Before It’s Loaded
        2. Lazy Serialization Example
          1. Creating the Product Interface
          2. Creating the Product Class
          3. Creating the Product Proxy Class
          4. Using the Proxy
      2. Remote Proxy
        1. Flickr Search Proxy Example
          1. Creating the Search Proxy
          2. Using the Search Proxy
        2. The flash.utils.Proxy
          1. Creating the Remote Photo Proxy
          2. Using the Photo Proxy
      3. Adapter and Façade Patterns
      4. Summary
    5. 7. Iterator Pattern
      1. Understanding the Problems with Iteration
      2. Understanding Iterator Elements
        1. The Iterator Interface
        2. The Concrete Iterator
        3. The Collection Interface
        4. The Concrete Collection
      3. Using Iterators
      4. Using Null Iterators
      5. Summary
    6. 8. Composite Pattern
      1. Understanding the Element Interface
      2. Understanding Leaf Elements
      3. Understanding Composite Elements
      4. Building a File System Example
      5. Summary
    7. 9. Decorator Pattern
      1. Understanding the Decorator Pattern
        1. Decorator/Decorated Interface
        2. Concrete Decorated Class
        3. Abstract Decorator Class
        4. Concrete Decorator Class(es)
      2. Building Reader Decorators
        1. Creating the Decorator/Decorated Interface
        2. Defining an Abstract Reader Class
        3. Defining the Concrete Decorated Class
        4. Creating the Abstract Decorator Class
        5. Defining the First Concrete Decorator Class
        6. Testing the Decorator
        7. Defining an Additional Concrete Decorator Class
        8. Defining a New Decorated Type
        9. Decorating Decorators
      3. Building Visual and Commutative Decorators
        1. Defining the Common Interface
        2. Defining Concrete Decorated Classes
        3. Defining Decorator Classes
        4. Adding Non-Commutative Decorators
      4. Summary
    8. 10. Command Pattern
      1. Understanding the Command Pattern
        1. The Interface
        2. The Concrete Command and Receiver
        3. The Client and Invoker
      2. Building a Simple Command Application
        1. Creating the Commands
        2. Creating a Receiver Type
        3. Creating a Button
        4. Creating the Command Containers
        5. Testing the Application
      3. Making Commands Undoable and Keeping Command Histories
      4. Building an Undoable Application
        1. Making Undoable Commands
        2. Recording Command History
        3. Adding an Undo Button
      5. Building a Redoable Application
        1. Implementing IRedoableCommand
        2. Adding the Redo Button
      6. Using Commands to Build a Proximity Game
        1. Defining the Player Data Class
        2. Defining a Collection Class for the Game Players
        3. Defining Game Pieces
        4. Defining the Game Board Data Class
        5. Defining the Game Play Command Class
        6. Defining the Game Factory Class
        7. Defining the Game Piece View and Controller Class
        8. Defining the Game Board View and Controller
        9. Defining the Main Class
      7. Summary
    9. 11. Memento Pattern
      1. Using Mementos to Make Actions Undoable in the Proximity Game
        1. Defining the Memento Type
        2. Creating the Originator
        3. Defining the Undoable Command Type
        4. Updating the Command Factory
        5. Updating the Main Class
      2. Using Mementos to Make Actions Redoable in the Proximity Game
        1. Defining the Redoable Command
        2. Editing the Factory Class
        3. Editing the Main Class
      3. Summary
    10. 12. State Pattern
      1. Simple State Example
        1. Create the Simple Shooter Class
        2. Create the Main Example Class
        3. Problems with This Example
      2. Encapsulating the States
        1. The Shooter State Interface
        2. State Objects
        3. The Shooter State Machine Class
        4. Creating the Main Example Class
      3. Using Abstract Classes
        1. The Abstract Shooter State
        2. State Objects
        3. The Shooter State Machine
        4. Creating the Main Example Class
      4. Transitions
        1. Transitions Defined in the State Machine
        2. Transitions Defined in the State Objects
      5. Summary
  6. III. Advanced ActionScript Topics
    1. 13. Working with Events
      1. Understanding Events
      2. Using Events
        1. Understanding Event Elements
        2. Registering Listeners
        3. Removing Event Listeners
        4. Understanding Event Phases
          1. The Capture Phase
        5. The Target Phase
        6. The Bubble Phase
          1. Event Priority
          2. Weak References
      3. Creating Event Dispatchers
        1. Understanding Event Objects
        2. Understanding Event Target Properties
        3. Default Behavior of Events
        4. Stopping Propagation
        5. Dispatching Events Through Inheritance
        6. The IEventDispatcher Interface
      4. An Example Working with Events
        1. Creating the IconButton Class
        2. Creating the Main Class
      5. Summary
    2. 14. Sending and Loading Data
      1. Loading Text
        1. Creating the LimerickData Class
        2. Creating the LimerickView Class
        3. Creating the Main Class
      2. Sending and Loading Variables
        1. Sending Variables
        2. Loading Variables
      3. Sending and Loading XML
        1. Sending XML
        2. Loading XML
      4. Using Web Services
      5. Using Flash Remoting
        1. Understanding Flash Remoting Basics
        2. Making Flash Remoting Calls
      6. Optimizing Data Communication
        1. Caching Data
        2. Queuing and Pooling Requests
      7. Summary
    3. 15. E4X (XML)
      1. Creating XML Objects
      2. Property Accessors
      3. XML Filtering
      4. Iterating Through an XMLList
      5. Namespaces
      6. Sending and Loading XML Data
      7. Simple Soap Example
        1. Building the Custom Event
        2. Building the Web Service Class
        3. Creating the Main Class
      8. Summary
    4. 16. Regular Expressions
      1. Introducing the RegExp Class
      2. Working with Regular Expressions
        1. Boolean Testing Regular Expressions
        2. Finding Matching Substring Indices
        3. Retrieving Matching Substrings
        4. Replacing Substrings Using Regular Expressions
      3. Using Regular Expression Flags
        1. The Global Flag
        2. The Ignore Case Flag
        3. The Multiline Flag
        4. The Dot Matches Newline Flag
        5. The Extended Flag
      4. Understanding Metacharacters and Metasequences
        1. Using Character Classes
        2. Working with Quantifiers
      5. Using Regular Expression Groups
      6. Building a Mad Libs Application Using Regular Expressions
        1. Creating the Data Model Classes
        2. Creating the Input Control
        3. Creating the View Classes
        4. Defining the Main Class
      7. Summary

Product information

  • Title: Advanced ActionScript 3 with Design Patterns
  • Author(s):
  • Release date: November 2006
  • Publisher(s): Adobe Press
  • ISBN: 9780321426567