The Essential Guide to Open Source Flash Developments

ENTER THE WORLD OF OPEN SOURCE FLASH
LEARN HOW TO INTEGRATE OPEN SOURCE
TOOLS INTO YOUR FLASH DEVELOPMENT
WORKFLOW
INCLUDES PAPERVISION3D, RED5, SWX, FUSE,
GO, HAXE, AMFPHP, AND MORE

CHRIS ALLEN • WADE ARNOLD • ARAL BALKAN
NICOLAS CANNASSE • JOHN GRDEN • MOSES GUNESCH
MARC HUGHES • R. JON MACDONALD • ANDY ZUPKO

The Essential Guide to
Open Source Flash Development
Chris Allen
Wade Arnold
Aral Balkan
Nicolas Cannasse
John Grden
Moses Gunesch
Marc Hughes
R. Jon MacDonald

Andy Zupko

The Essential Guide to
Open Source Flash Development
Copyright © 2008 by Chris Allen, Wade Arnold, Aral Balkan, Nicolas Cannasse, John Grden, Moses Gunesch, Marc Hughes,
R. Jon MacDonald, Andy Zupko
All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or
mechanical, including photocopying, recording, or by any information storage or retrieval system, without the
prior written permission of the copyright owner and the publisher.
ISBN-13 (pbk): 978-1-4302-0993-5
ISBN-13 (electronic): 978-1-4302-0994-2
Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1
Buzzy illustrated by Sillapanon Hattachanchai, based on a sketch by Aral Balkan. Copyright © 2008 OSFlash.org. Released under the
Creative Commons Attribution 2.0 UK: England & Wales License (creativecommons.org/licenses/by/2.0/uk/).
Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name,
we use the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the
trademark.
Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor, New York, NY 10013.
Phone 1-800-SPRINGER, fax 201-348-4505, e-mail orders-ny@springer-sbm.com, or visit www.springeronline.com.
For information on translations, please contact Apress directly at 2855 Telegraph Avenue, Suite 600, Berkeley, CA 94705.

Phone 510-549-5930, fax 510-549-5939, e-mail info@apress.com, or visit www.apress.com.
Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use. eBook versions and licenses
are also available for most titles. For more information, reference our Special Bulk Sales–eBook Licensing web page at
http://www.apress.com/info/bulksales.
The information in this book is distributed on an “as is” basis, without warranty. Although every precaution has been taken in the
preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any
loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work.
The source code for this book is freely available to readers at www.friendsofed.com in the Downloads section.

Credits
Lead Editor
Ben Renow-Clarke

Production Editor
Laura Esterman

Technical Reviewer
Christophe Herreman

Compositor

Dina Quan

Editorial Board
Clay Andres, Steve Anglin, Ewan Buckingham,
Tony Campbell, Gary Cornell, Jonathan Gennick,
Matthew Moodie, Joseph Ottinger, Jeffrey Pepper,
Frank Pohlmann, Ben Renow-Clarke,
Dominic Shakeshaft, Matt Wade, Tom Welsh

Proofreader
April Eddy

Project Manager
Kylie Johnston
Copy Editor
Kim Wimpsett
Associate Production Director
Kari Brooks-Copony

Indexer

Becky Hornyak

Artist
April Milne
Interior and Cover Designer
Kurt Krames
Manufacturing Director
Tom Debolski

For my dear, wonderful parents, Haluk and Mehlika Balkan. Thank
you for a lifetime of unconditional love and support. Thank you
for believing in me. Thank you for teaching me that I can do
anything I set my mind to. I am forever in your debt.
—Aral Balkan
To Airi.
—Nicolas Cannasse
A glass raised to Winsor McCay—the original animator and one of
America’s greatest talents.
—Moses Gunesch
To my wife, Jess, for putting up with me, and to the open source

community, for constantly amazing me.
—Marc Hughes
To my family and friends who provide constant encouragement
and support even though I often take on much more work
than our relationships should allow.
—R. Jon MacDonald

CONTENTS AT A GLANCE
About the Authors .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

About the Technical Reviewer .
Acknowledgments .
Introduction

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

xix


. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

xxi

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Chapter 1 Introducing the World of Open Source Flash
Chapter 3 Preparing an Open Source Workflow
Chapter 4 Using an Open Source Workflow
Chapter 5 Testing and Debugging .
Chapter 7 Using AMFPHP

1
7

. . . . . . . . . . . . . . . . . .

19

. . . . . . . . . . . . . . . . . . . . .


55

101

. . . . . . . . . . . . . . . . . . . . . . . .

131

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

153

Chapter 8 Working with SWX: The Native Data Format for
the Flash Platform . . . . . . . . . . . . . . . . . . . . . .
Chapter 9 Using haXe .

. . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . .


Chapter 6 Deploying Your Application

xxiii

. . . . . . . . . . . . .

Chapter 2 Exploring Open Source Flash: What’s Available .

. . . . . . . . .

197

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

227

Chapter 10 Fuse and GoASAP: Open Source Animation Tools

. . . . . . .


247

. . . . . . . . . . . . . . . . . . . . . . . . . . . .

291

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

309

Chapter 11 Using Papervision3D .
Chapter 12 Introducing Red5

Chapter 13 Building Some Red5 Apps .
Index .

xv

. . . . . . . . . . . . . . . . . . . . . . . .


337

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

367

v

CONTENTS
About the Authors .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

About the Technical Reviewer .
Acknowledgments .
Introduction

xv


. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

xix

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

xxi

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Chapter 1 Introducing the World of Open Source Flash

xxiii

. . . . . . . . . . . . .

Chapter 2 Exploring Open Source Flash: What’s Available .

. . . . . . . . . . .

1
7

Community open source initiatives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Development tools. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
MTASC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
ASDT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
FlashDevelop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
haXe development tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
swfmill . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
SWFObject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Ant. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Sprouts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Libraries and toolkits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Fuse Kit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Papervision3D. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Screenweaver HX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Server-side technologies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
AMFPHP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Red5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
SWX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Adobe open source initiatives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Flex 3 SDK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
BlazeDS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
ActionScript 3 libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
And many more . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

vii

CONTENTS

Chapter 3 Preparing an Open Source Workflow

ActionScript 3 development . . . . . . . . . . . . . . . . . . . .
Introducing the Flex SDK. . . . . . . . . . . . . . . . . . . .
Installing the Java JDK . . . . . . . . . . . . . . . . . . . . .
Installing the Flex SDK . . . . . . . . . . . . . . . . . . . . .
Configuring your system’s search path . . . . . . . . . .
Testing your installation . . . . . . . . . . . . . . . . . .
Installing FlashDevelop . . . . . . . . . . . . . . . . . . . . .
ActionScript 2 development . . . . . . . . . . . . . . . . . . . .
Installing MTASC . . . . . . . . . . . . . . . . . . . . . . . .
Installing an IDE . . . . . . . . . . . . . . . . . . . . . . . . .
Installing Eclipse . . . . . . . . . . . . . . . . . . . . . . . .
Installing Eclipse plug-ins. . . . . . . . . . . . . . . . . . . .
Installing ASDT . . . . . . . . . . . . . . . . . . . . . . .
Installing FDT . . . . . . . . . . . . . . . . . . . . . . . .
Installing ActionScript 2 libraries . . . . . . . . . . . . .
Creating a project . . . . . . . . . . . . . . . . . . . . .
Common components . . . . . . . . . . . . . . . . . . . . . . .
Installing swfmill . . . . . . . . . . . . . . . . . . . . . . . .
Installing Xray . . . . . . . . . . . . . . . . . . . . . . . . . .
Installing the ActionScript 3 connector . . . . . . . . .
Installing the ActionScript 2 connector . . . . . . . . .
Installing the Xray interface . . . . . . . . . . . . . . . .
Installing a web server . . . . . . . . . . . . . . . . . . . . . . .
Installing Ant. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Using FlashDevelop to create an ActionScript 3 build script
Using Eclipse to create an ActionScript 2 build script . . . .

Chapter 4 Using an Open Source Workflow
Getting assets from designers . . . . . . . . . . . .
Integrating SWFs from designers . . . . . . . . . .
Creating some data . . . . . . . . . . . . .
ActionScript 3 development . . . . . . . . . . . . .
Creating a Flash application with FlashDevelop
Entering the code . . . . . . . . . . . . . .
Building the application . . . . . . . . . . .
Building with Ant . . . . . . . . . . . . . . .
Creating a Flex application with FlashDevelop .
Creating the project . . . . . . . . . . . . .
Entering the code . . . . . . . . . . . . . .
Building the application . . . . . . . . . . .
Building with Ant . . . . . . . . . . . . . . .

viii

.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.

19

. . . . . . . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

55

. . . . . . . . . . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.

20
20
20
21
22
23
23
27
27
28
29
30
31
32
33
35
41
41
42
42
42
47
47
48
49
50

.
.
.
.
.
.
.
.
.
.
.
.
.

56
56
58
60
60
60
67
70
71
71
72
76
76

CONTENTS

ActionScript 2 development . . . . . . . .
Adding the asset to your project . . .
Modifying the build process . . . . . .
Reading a list of recipes . . . . . . . .
Copying the input file . . . . . . .
Create a Recipe class. . . . . . . .
Load the XML file . . . . . . . . .
Create an XML parser . . . . . . .
Bringing it all together . . . . . . . . .
Viewing the recipe details . . . . . . .
Creating the RecipeDetails.swf file
Updating the build script . . . . .
Loading RecipeDetails.swf . . . . . . .
Displaying the recipe details . . . . . .

Chapter 5 Testing and Debugging .
Unit testing . . . . . . . . . . . . . . . . . .
Test cases, suites, and runners . . . . .
Test case . . . . . . . . . . . . . . .
Test suite. . . . . . . . . . . . . . .
Test runner . . . . . . . . . . . . .
Structuring tests. . . . . . . . . . .
Creating n-tiered testing hierarchies .
Getting started with AsUnit . . . . . . . . .
An overview of key AsUnit classes . . .
Creating an AsUnit test case . . . . . .
Creating an AsUnit test suite . . . . . .
Creating an AsUnit test runner. . . . .
Getting started with FlexUnit . . . . . . . .
Creating the FlexUnit example . . . . .
Creating the FlexUnit test case. . . . .
Creating the FlexUnit test suite . . . .
Creating the FlexUnit test runner . . .
Asynchronous testing . . . . . . . . . .
Further reading . . . . . . . . . . . . .
Using Xray as a debug tool . . . . . . . . .
Using Xray to log effectively . . . . . .
Using the Xray Property Inspector . . .
Taking a snapshot . . . . . . . . . .
Modifying values . . . . . . . . . .
Inspecting nonvisual objects . . . . . .
Executing ActionScript at runtime . . .
Finding performance bottlenecks .

.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.

77
78
78
80
80
81
83
87
89
92
92
94
95
95

. . . . . . . . . . . . . . . . . . . . . . . . . . .

101

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

101
102
102
103
103
104
105
106
107
107
109
109
112
114
114
115
116
118
120
120
120
123
124
125
126
128
128

ix

CONTENTS

Chapter 6 Deploying Your Application

. . . . . . . . . . . . . . . . . . . . . . . .

Embedding SWF content . . . . . . . . . . . . . . . . . . . . .
Using SWFObject . . . . . . . . . . . . . . . . . . . . . . .
Installing SWFObject . . . . . . . . . . . . . . . . . . .
SWFObject static publishing method . . . . . . . . . .
SWFObject dynamic publishing method . . . . . . . .
Staging strategies . . . . . . . . . . . . . . . . . . . . . . . . .
Transferring your files . . . . . . . . . . . . . . . . . . . . . . .
Using Ant and FTP. . . . . . . . . . . . . . . . . . . . . . .
Using Ant and SFTP/SCP . . . . . . . . . . . . . . . . . . .
Executing commands on the server . . . . . . . . . . . . .
Excluding files . . . . . . . . . . . . . . . . . . . . . . . . .
Deploying desktop applications . . . . . . . . . . . . . . . . .
How it works . . . . . . . . . . . . . . . . . . . . . . . . . .
Creating the front-end SWF . . . . . . . . . . . . . . . . .
Creating the Screenweaver back-end . . . . . . . . . . . .
Compiling the Screenweaver back-end . . . . . . . . .
Interacting with the Screenweaver application from Flash
Distributing your desktop application . . . . . . . . . . . .

Chapter 7 Using AMFPHP

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Introducing AMFPHP . . . . . . . . . . . . . . . . . . . . . . .
What are the benefits of AMF? . . . . . . . . . . . . . . .
What are the benefits of using AMFPHP? . . . . . . . . . .
The requirements for using AMFPHP in the examples . . .
Getting started . . . . . . . . . . . . . . . . . . . . . . . . . . .
Installation requirements . . . . . . . . . . . . . . . . . . .
Server configuration . . . . . . . . . . . . . . . . . . . . .
Testing the server installation . . . . . . . . . . . . . . . .
It’s installed! . . . . . . . . . . . . . . . . . . . . . . . . . .
Creating your first service . . . . . . . . . . . . . . . . . . . . .
Using the Service Browser tool. . . . . . . . . . . . . . . .
Consuming HelloWorld . . . . . . . . . . . . . . . . . . . .
The HelloWorld logic . . . . . . . . . . . . . . . . . . . . .
Creating, reading, updating, and deleting with Flash and PHP.
Building the database adapter . . . . . . . . . . . . . . . .
Testing the database connection. . . . . . . . . . . . . . .
Integrating the database and Flash . . . . . . . . . . . . .
Updating the product database . . . . . . . . . . . . . . . . .
Additional ProductService methods . . . . . . . . . . . . .
Interface alterations to manipulate products . . . . . . . .
Connecting to HelloWorld with Flex . . . . . . . . . . . . . . .
Using Flex to update the product database . . . . . . . . . . .
Class mapping from PHP to ActionScript 3 . . . . . . . . . . .
Creating the data access object . . . . . . . . . . . . . . .
Displaying value objects in Flex . . . . . . . . . . . . . . .
Creating the application . . . . . . . . . . . . . . . . . . .

x

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

131
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

131
133
134
134
136
137
140
140
143
144
145
145
146
146
147
148
149
151

153
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

153
154
155
155
156
156
156
157
157
157
158
159
161
164
164
165
166
169
169
170
173
180
185
186
187
187

CONTENTS

Debugging . . . . . . . . . . . . . . . . . .
Narrowing it down . . . . . . . . . . .
Dealing with a corrupt PHP installation
Dealing with service errors . . . . . . .
Dealing with ActionScript errors . . . .
Thanks . . . . . . . . . . . . . . . . . . . . .

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

Chapter 8 Working with SWX: The Native Data Format for
the Flash Platform . . . . . . . . . . . . . . . . . . . . . .
The SWX philosophy: systemwide simplicity. . . . . . . . . . . . . .
Simple . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Enjoyable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Experience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
A common vocabulary . . . . . . . . . . . . . . . . . . . . . . . . .
Why do you need a new data format?. . . . . . . . . . . . . . . . .
Supported platforms and technologies . . . . . . . . . . . . . . . .
How simple is SWX? . . . . . . . . . . . . . . . . . . . . . . . . . . .
Diving deeper: SWX AS, SWX Service Explorer, SWX Data Analyzer.
SWX AS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
SWX Service Explorer . . . . . . . . . . . . . . . . . . . . . . . .
SWX Data Analyzer . . . . . . . . . . . . . . . . . . . . . . . . .
Installing SWX on your server. . . . . . . . . . . . . . . . . . . . . .
Mac OS X. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
All platforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Writing your first custom service . . . . . . . . . . . . . . . . . . . .
Creating the calculator service class in PHP. . . . . . . . . . . .
Testing the calculator service with the SWX Service Explorer . .
Consuming your calculator service in Flash . . . . . . . . . . . .
Using a result handler . . . . . . . . . . . . . . . . . . . . .
Using a timeout handler . . . . . . . . . . . . . . . . . . . .
Using a fault handler . . . . . . . . . . . . . . . . . . . . . .
Case study: p.i.n.k. Spirits . . . . . . . . . . . . . . . . . . . . . . . .
Project: utilizing a custom service in Flash Lite . . . . . . . . . . . .
Goal: a product locator . . . . . . . . . . . . . . . . . . . . . . .
The PHP service class . . . . . . . . . . . . . . . . . . . . . .
Downloading the SWX ActionScript library. . . . . . . . . .
Setting up the Flash Lite application FLA . . . . . . . . . . .
Establishing an initial service connection . . . . . . . . . . . . .
Creating assets for search and results states . . . . . . . . . . .
Adding the functionality . . . . . . . . . . . . . . . . . . . . . .
Getting more information. . . . . . . . . . . . . . . . . . . . . . . .

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

191
191
192
193
194
195

. . . . . . . . .

197

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

198
198
198
198
198
199
200
201
202
202
202
203
204
205
205
205
205
206
207
207
207
208
208
210
211
213
213
214
214
214
215
218
220
224

xi

CONTENTS

Chapter 9 Using haXe .

Flash for developers . . . . . . . . . . . .
The arrival of MTASC . . . . . . . . .
ActionScript 3 . . . . . . . . . . . . .
The birth of haXe . . . . . . . . . . .
haXe for Flash . . . . . . . . . . . . . . .
Installing haXe . . . . . . . . . . . . .
haXe IDE . . . . . . . . . . . . . . . .
Hello, haXe! . . . . . . . . . . . . . .
HXML files . . . . . . . . . . . . . . .
Displaying the SWF . . . . . . . . . .
haXe trace . . . . . . . . . . . . . . .
haXe vs. ActionScript . . . . . . . . . . .
Syntax differences . . . . . . . . . . .
Basic types differences . . . . . . . .
API differences. . . . . . . . . . . . .
haXe features. . . . . . . . . . . . . . . .
Feature 1: libraries . . . . . . . . . .
Feature 2: interoperability . . . . . .
Feature 3: type inference . . . . . . .
Feature 4: typed arrays . . . . . . . .
Feature 5: ActionScript 3 generator .
Feature 6: speed . . . . . . . . . . . .
Feature 7: independence . . . . . . .
Feature 8: and much more . . . . . . .
Summary . . . . . . . . . . . . . . . . . .

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

Chapter 10 Fuse and GoASAP: Open Source Animation Tools
Introducing Fuse . . . . . . . . . . . . . . . . . .
Introducing GoASAP . . . . . . . . . . . . . . . .
Fuse 2: solving ActionScript 2 problems . . . . .
Open source mash-up . . . . . . . . . . . .
The need for speed in AVM 1 . . . . . . . .
A faster engine . . . . . . . . . . . . . .
Reality check . . . . . . . . . . . . . . .
ZigoEngine: Fuse’s animation engine . . . .
Beginner options . . . . . . . . . . . . .
Stylizing motion . . . . . . . . . . . . . . . .
Fuse: sequencing simplicity . . . . . . . . . .
Animation shorthand . . . . . . . . . . .
A playable list . . . . . . . . . . . . . . .
Smart parsers have more fun . . . . . .
Matching timeline functionality . . . . .
Keepin’ it dynamic . . . . . . . . . . . .
A problem Fuse 2 didn’t solve . . . . . .
Life after Fuse 2: transitioning to ActionScript 3

xii

227

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

227
228
229
230
231
231
231
232
232
232
233
235
235
236
236
238
238
239
240
240
241
241
242
243
244

. . . . . . .

247

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

247
248
248
248
249
249
250
250
252
252
253
254
255
257
259
260
261
261

CONTENTS

The Go ActionScript animation platform . . . . .
DIY developer teams . . . . . . . . . . . . . .
The need for speed in AVM 2 . . . . . . . . .
GoEngine: multiple pulses . . . . . . . . .
Less is more . . . . . . . . . . . . . . . . .
Go architecture . . . . . . . . . . . . . . . . .
Core compatibility layer . . . . . . . . . .
GoItem layer. . . . . . . . . . . . . . . . .
Utility layer . . . . . . . . . . . . . . . . .
Manager layer . . . . . . . . . . . . . . . .
Rolling your own animation classes . . . . . .
Using the custom tween . . . . . . . . . .
Making the tween work with managers. .
EllipseTween . . . . . . . . . . . . . . . . . . .
Testing the Tweens with OverlapMonitor .
GoASAP, garbage collection, and memory . .
Footprint. . . . . . . . . . . . . . . . . . .
Into the wild: physics, 3D, and beyond . . . .
Bustin’ loose . . . . . . . . . . . . . . . . .

Chapter 11 Using Papervision3D .

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

. . . . . . . . . . . . . . . . . . . . . . . . . . . .

Who’s who . . . . . . . . . . . . . . . . . .
The core team . . . . . . . . . . . . . .
The committer team . . . . . . . . . .
Getting started with Papervision . . . . . .
SVN . . . . . . . . . . . . . . . . . . . .
The CS3 component . . . . . . . . . .
Explanation of the parts . . . . . . . . . . .
Scene: the what . . . . . . . . . . .
Viewport: the where . . . . . . . .
Renderer: the how . . . . . . . . .
Camera: from what point of view .
Objects in Papervision . . . . . . . . . . . .
Primitives . . . . . . . . . . . . . . . . .
COLLADA. . . . . . . . . . . . . . . . .
Materials . . . . . . . . . . . . . . . . . . .
Color materials . . . . . . . . . . . . .
Bitmap materials. . . . . . . . . . . . .
Movie materials . . . . . . . . . . . . .
Shaded materials . . . . . . . . . .
Interactivity . . . . . . . . . . . . .
Your first Papervision project . . . . . . . .
Setting up Flash . . . . . . . . . . . . .
Creating the asset . . . . . . . . . . . .
Initializing the scene . . . . . . . . . .
Adding the cube. . . . . . . . . . . . .
Summary . . . . . . . . . . . . . . . . . . .

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

262
263
263
264
265
265
266
266
267
267
268
275
280
282
285
286
288
288
289

291
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

292
292
292
293
293
293
294
294
294
294
295
295
295
296
296
297
297
297
297
297
297
298
299
301
302
306

xiii

CONTENTS

Chapter 12 Introducing Red5

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

The history of Red5 . . . . . . . . . . . . . . . . . . . . .
Why the name Red5? . . . . . . . . . . . . . . . . . . . .
Installing Red5 . . . . . . . . . . . . . . . . . . . . . . . .
Simple Windows setup . . . . . . . . . . . . . . . . .
Checking your installation . . . . . . . . . . . . . . .
Setting up your development environment . . . . . . . .
Why set up Red5 to run in Eclipse in the first place?
Setting up Eclipse for Red5 development . . . . . . .
Starting Red5 in Eclipse . . . . . . . . . . . . . . . . .
How Red5 web applications are set up . . . . . . . . . .
Directory structure of Red5 applications . . . . . . .
Source code . . . . . . . . . . . . . . . . . . . . . . .
Configuration files. . . . . . . . . . . . . . . . . . . .
web.xml . . . . . . . . . . . . . . . . . . . . . . .
red5-web.xml . . . . . . . . . . . . . . . . . . . .
red5-web.properties . . . . . . . . . . . . . . . .
log4j.properties . . . . . . . . . . . . . . . . . . .
Connecting to myTest with Flash . . . . . . . . . . . . . .
Debugging Red5 in Eclipse . . . . . . . . . . . . . . . . .

Chapter 13 Building Some Red5 Apps .

xiv

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

. . . . . . . . . . . . . . . . . . . . . . . .

Simple samples. . . . . . . . . . . . . . . . . . . .
Exploring SimpleBallDemo . . . . . . . . . . . . .
Exploring SimpleBroadcaster and SimpleRecorder
Exploring SimpleSubscriber . . . . . . . . . . . . .
Creating simple chat using SoSend. . . . . . . . .
Exploring SimpleStreamPlayer . . . . . . . . . . .
Being a guitar hero . . . . . . . . . . . . . . . . .
Getting a list of MIDI devices . . . . . . . . . . . .
Receiving MIDI messages . . . . . . . . . . . .
Sending MIDI messages . . . . . . . . . . . . .
Flexing your Red5 muscles . . . . . . . . . . . . .
VideoBroadcaster.mxml. . . . . . . . . . . . .
VideoPlayer.mxml . . . . . . . . . . . . . . . .
Chat.mxml . . . . . . . . . . . . . . . . . . . .
Links and more. . . . . . . . . . . . . . . . . . . .

Index .

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

309
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

310
312
312
313
318
320
321
321
323
325
326
327
328
328
328
328
329
329
331

337
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

337
338
341
344
346
349
350
351
354
355
359
360
361
362
363

367

ABOUT THE AUTHORS
With extensive experience developing for the Flash Platform and
Java, Chris Allen is a leader in the open source Flash community.
Over the past eight years he has been a software architect and
developer for various companies including Cambridge Technology
Partners, Mass General Hospital, and Scholastic. Chris is currently the
president and CEO of Infrared5, a consulting firm built around services for the open source Red5 server, and he is the co-project manager and a Java developer for the open source Red5 project.

Wade Arnold is the CEO of T8DESIGN, which is a rich media and
application firm located in Cedar Falls, Iowa. Wade is responsible for
strategic planning and product development as well as for creating
an exciting and rewarding corporate environment. Wade has been
selected to be a speaker at several national software development
and security conferences. He has an active dialogue with Adobe and
actively participates in prerelease beta development of Flash, Flex,
and AIR, and he is passionately involved in open source Flash/Flex
development and aligns T8DESIGN behind these initiatives. Wade is
the lead developer of AMFPHP and the open source implementation
of Flash Remoting. Wade has a degree in computer science emphasizing intelligent systems and
an MBA from the University of Iowa. T8DESIGN works with hundreds of community banks
and medium to enterprise customers including Nike, McDonald’s, John Deere, AT&T, Lindsay
Corporation, Best Buy, and the Department of Defense.
Aral Balkan is a Flash Platform veteran and overall Internet junkie.
Oh, and this year he’s producing the world’s first large-scale online
web conference, Singularity.
Aral cofounded and coordinates OSFlash.org, authored the patternbased ActionScript framework Arp, and created the SWX data format, SWX RPC, and SWX PHP. His latest open source project is the
GAE SWF Project, providing Flash and Flex developers with knowledge and tools to build Rich Internet Applications on Google App
Engine.

xv

ABOUT THE AUTHORS

Aral is a published author and has contributed to several books and magazine articles.
Specifically, he is the author of the Adobe Flex 2 QuickStart Guide and Flex 3 QuickStart Guide
and has authored six courses on Flash, Flex, ActionScript, and open source development.
Aral is a regular speaker at international conferences including Macworld, FlashForward,
d.construct, FITC, Wizards of OS, and Adobe MAX.
Nicolas Cannasse is one of the cofounders of OSFlash.org and the
creator of the MTASC compiler. He is also the CTO at Motion-Twin, a
French independent game studio making web games in Flash. For
the past two years, he has been working on haXe, an open source
programming language for the Web, capable of compiling to Flash
but also to JavaScript and the server side.

With more than eight years of experience in working with Flash
technology, John Grden is the creator of the Xray debugger, FLEXible
(an MXML editor), and the FLASC compiler GUI, and he is a core
member and contributor on the Papervision3D project. John also
started the Red5 open source server project and is the co-project
manager along with Chris Allen. John has also served as the director
of Flash Platform for BLITZ and was the senior Flash developer with
Zing.com. John currently lives near Houston, Texas, and works as a
senior software developer for Infrared5.
Moses Gunesch has spent a decade teaching and working with
ActionScript, inspired early on by Flash phenomena like Flight404.com,
Remedi Project, Praystation, Second Story, Deconcept, Natzke.com,
Yugop.com, and Robert Penner. MosesSupposes.com is currently
based in Brooklyn, where Moses can be found architecting largescale web applications for advertising clients and startup ventures
(between tasty slices of New York pizza). His current interest in
social networking design is rooted in having cofounded the popular
GotoAndPlay.net group in his hometown of Portland, Oregon, in
2001—a hub for Flash, 3D, and graphic design professionals and
host to its own digital film festival. Moses established himself as a leading figure in animation
systems for ActionScript with his popular Fuse Kit. Fuse has now been used in more than 60
countries, as well as in many top advertising agencies and award-winning websites. Moses strives
to continue contributing valuable ideas to the ActionScript community via open source.

xvi

ABOUT THE AUTHORS

Marc Hughes is the manager of software engineering at Tom Snyder
Productions, an educational software publisher in Watertown,
Massachusetts. While there, he’s worked on several large educational applications including FASTT Math and TimeLiner XE. Outside
of his day job, Marc wrote AgileAgenda (http://www.agileagenda.
com), an AIR/Flex-based project-scheduling application that won the
Best in Show award of Adobe’s AIR Developer Derby in October
2007. He’s also authored several useful Flex-based open source
projects, including a popular library called ObjectHandles that
allows users to move and resize components inside a Flex application. His open source projects, as well as his blog, can be found at http://www.roguedevelopment.com.
A certified Adobe Flash and web developer, R. Jon MacDonald offers
a wealth of expertise in development, design, usability, and visual
communication. Over the course of nine years, Jon has honed his
skills through a multitude of experiences.
Jon works with household brands, advertising agencies, and talented
designers and developers across the country through JonnyMac
Design, the interactive collective he started, as well as XPLANE, a
consulting and design firm that drives business results by clarifying
complex information through visual communications.
His portfolio and blog can be found at http://www.jonnymac.com.
With more than seven years development experience, Andy Zupko
has extensive knowledge of object-oriented programming and the
Flash framework. Originally a developer of COM servers for medical
imaging systems and custom RIAs, he has recently shifted his focus
to the development of front-end UIs, combining math and visuals to
create rich environments that enhance user experience. He is a
senior software engineer for Infrared5 and a core member of the
Papervision3D team.

xvii

ABOUT THE TECHNICAL REVIEWER
Christophe Herreman is a software architect and developer living in
Belgium. He mainly focuses on Flex-based Rich Internet Applications
and likes to philosophize about object-oriented development. He is
an active open source contributor and the author and lead developer of the Prana Framework (http://www.pranaframework.org).
He has also been involved in other projects such as AS2lib, AMFPHP,
and ARP.
You can find him blogging at http://www.herrodius.com.

xix

ACKNOWLEDGMENTS
I would like to thank my wife and business partner, Rebecca Allen, for supporting me while I’m
trying to do too much. I would also like to thank everyone on the Red5 team for doing their
parts to make Red5 a reality. Some of those guys include John Grden, Luke Hubbard, Joachim
Bauch, Dominick Accattato, Paul Gregoire, Steven Gong, and Thijs Triemstra. It’s also worth
mentioning a word of gratitude to conference organizers Shawn Pucknell, Stewart McBride, and
John Davey for seeing the potential and interest in Red5 and being willing to take a chance on
letting us present on our technology before it was the thing to do. Others who deserve mention
are Keith Peters, Sam Agesilas, Todd Anderson, Jon Valliere, Andy Zupko, Richard Blakely, Jerry
Chabolla, and Paul Blakely. Then of course there’s the whole team at friends of ED that made
this book possible: Chris Mills, Ben Renow-Clarke, Pete Aylward, Kylie Johnston, Kim Wimpsett,
and the rest. Thanks!
Chris Allen
I would like to thank the community of developers who continue to push what is capable
online. Your questions and inspirational projects are what keep me working into the late hours
to push what is possible. To Dr. Gray and Dr. Wallingford, thank you for teaching me how to
think computer science. For allowing me to start working on computers from an early age when
the rest of the world could not even access a PC, thank you, Mom and Dad; in addition to
resources, thanks for aiding in the development of my perseverance. And most important,
thanks to my amazing wife, Shannon, who not only puts up with but supports my dreams.
Bushel and a peck, Shannon, David, and #2!
Wade Arnold
I want to thank the open source Flash community: every day I learn from you, I get inspired by
the amazing things you do, and I feel honored to count so many of you among my friends. You
make a difference every day by sharing your knowledge and your passion with others. You are
the soul of Flash.
Aral Balkan
I’d like to thank Aral for being a good friend and allowing me to help out way back when we
were creating new OS projects by hand and for giving us a place to park these awesome ideas!
Without Aral, we wouldn’t have a community like we do now—that’s a fact. Also, I don’t know
where I’d be without Chris Allen—he has been a great friend, has been an awesome mentor,
and has really made an impact on my Flash life. I couldn’t have gotten this far without him. I
have to say thanks to Luke Hubbard, Joachim Bauch, Steven Gong, and Dominick Accattato for
having the backbones to jump in on Red5 from day one and make it happen! That comprises
the “original 6” that was known back in the day when Red5 first breathed life. I have to give

xxi

ACKNOWLEDGMENTS

thanks for my family as well: Linda, Riley, and Luke (yes, I named my son after Luke Skywalker—
get used to it). Because of them, I was able to do these projects and succeed, and they’re the
coolest fans I could ever ask for. I love them dearly. And mostly, I want to thank God for all the
blessings he’s given me; by saving me from either myself or calamity altogether, he’s always
been by my side, and I’m most grateful for His patience, peace, and help in my life. Rock on.
John Grden
I would like to thank my parents, whose foresight to put a Commodore 64/128 in my bedroom
as a child provided me with the start to a wonderful means of turning a passion into a living.
Thanks to Aral Balkan for providing me with this opportunity and trusting me to do right by his
project. Thanks to all of my co-workers, past and present, who have influenced and aided in my
growth as a developer. Finally, thanks to the amazing Flash Platform community—without such
an active and open community, projects like those included in this book would not exist.
R. Jon MacD