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