Book Description
With the release of Macromedia Flash 8, Flash is now the most powerful and widely used client software for the web, and it's the only one that runs on virtually every browser, on every platform. It also features ActionScript, a scripting language with great object-oriented support. As such, Flash is the ideal platform for producing sophisticated object-oriented web applications. Complex applications demand a solid understanding of object-oriented programming (OOP) techniques, regardless of the language and platform used, and this book will provide all you need.
Object-Oriented ActionScript For Flash 8 teaches the theory and practice of OOP with ActionScript. You do not need any extensive prior programming experience, you just need to want to go beyond the usual Flash interfaces. Authors, and working Flash developers, Peter Elst and Todd Yard take you through the complete development cycle of a series of related applications, using numerous step-by-step instructions. You'll be able to develop highly reusable applications and services that leverage the dynamic features in Flash.
This book demonstrates professional OOP skills and techniques that are completely transferable to other programming languages and technologies, including Inheritance, Polymorphism, managing classes, component development, consuming web services, and much more. It also includes some cutting edge ActionScript programming techniques, and animation and effects classes.
Summary of Contents:
PART ONE: OOP AND ACTIONSCRIPT
Chapter 1: Introduction to OOP
Chapter 2: Programming Concepts
Chapter 3: ActionScript 2.0 Programming
PART TWO: FLASH OOP GUIDELINES
Chapter 4: Planning
Chapter 5: Project Workflow
Chapter 6: Best Practices
PART THREE: CORE OOP CONCEPTS
Chapter 7: Encapsulation
Chapter 8: Classes
Chapter 9: Inheritance
Chapter 10: Polymorphism
Chapter 11: Interfaces
Chapter 12: Design Patterns
Chapter 13: Case Study: An OOP Media Player
PART FOUR: BUILDING AND EXTENDING A DYNAMIC FRAMEWORK
Chapter 14: Framework Overview
Chapter 15: Manager Classes
Chapter 16: UI Widgets
Chapter 17: OOP Animation and Effects
PART FIVE: DATA INTEGRATION
Chapter 18: Interrelationships and Interactions Between Components
Chapter 19: Communication Between Flash and the Browser
Chapter 20: Server Communication (XML and Web Services)
Chapter 21: Case Study: Time Sheet Application
/p>
Reviews From AMAZON.COM
OOP for the layman
This has to be one of the "must-buy" titles for any flash developer wishing to use OOP in his programming tool kit. This book gently guides the reader through all the key concepts of OOP and more importantly backs them up with simple but concrete examples. Please don't underestimate the importance of 'simple and concrete,' because when it comes to explaining, 'Design Patterns,' try and read just about any other book out there including Colin Mook's very excellent, "Essential Actionscript 2", and you'll soon learn how the theory and the complexity can have your head swimming. This book, on the other hand, makes learning fun and the authors deserve some kind of accolade for so succinctly rendering the concepts in well chosen but accessible terms.
Best book on OOP with ActionScript
This is another great book from friends of Ed. It fits into a glaring and previously empty niche in the landscape of ActionScript publications. Like other friends of Ed books, it's written in plain language that anyone can understand. With that said, you should already have a very solid footing in the basic syntax and usage of ActionScript. This book doesn't waste much time explaining how to write basic script. The first third of the book covers some simple theory that explains the purpose for OOP and how to plan out your project. But once the theory is over, the programming is fast and furious. I think the best way to describe the book is "practical". It's not 500 pages of dogma passed down from people in the ivory tower. It's basically two of the best ActionScript developers in the business showing how they approach problems that we all come across every day.
The first chapter, "Introduction to OOP", contains the best explanation of objects and classes that I've seen. If you're thinking that it's time to move on from timeline code to classes, this chapter alone should help the most in getting you started. The writers keep it short and sweet, yet these eight pages contain many great diagrams and analogies to ease you into core concepts including encapsulation, inheritance, and polymorphism. It's so simple to visualize things like a blueprint (class) being used to create a house (object), or the fact that cars from two different companies, such as Volkswagen and Toyota, can both be started by turning a key (inheritance and interfaces). To keep the reader in a programming mindset, a few lines of pseudo-code help to reinforce each new concept.
In the next couple of chapters, the authors introduce basic programming concepts and the Actionscript 2 language. This section goes by very quickly, and if you're just getting started, you might want to read it over a couple of times. It seems to me that the authors pretty much assume that you've already done a bit of programming and you're really looking to move on to the next. If you're coming from a different language, like Java, it's perfect because you can easily skim to each example of syntax. Everytime I pick up a book to learn a new language, I hate reading through half a dozen chapters that assume that I've never heard of a compiler or a variable.
Chapter 4 presents ways to plan a programming project. The reader learns about different projects phases and how to use UML to represent classes and their relationships. Chapter 5 introduces workflow tools like version control systems (like CVS or Subversion), programming approaches like RAD and Extreme Programming, and a short section on usability. The final chapter in this section goes over some of the authors' personal best practices. They present different ways to format code, reasons for using comments, and good naming schemes for variables and functions.
With the basics out of the way, the authors begin showing real Actionscript examples of those core programming concepts covered in the first chapter. They start out with some basic encapsulation that seperates different actions into functions. As the first bit of real code, the example of a ball moving on the stage is represented in timeline code. Personally, I would have liked to see the authors just move straight into classes, but this example is a good way to get a beginner started and to keep things familiar for Flash users that are already used to the concept of the timeline.
Next, the authors start implementing their first classes. Additional parts of classes like constructors, member variables and methods give the reader his or her first taste of what's in store. Again, examples with real-world objects, like cars, help illustrate how classes work. The "Mover" class at the end of this chapter brings the earlier ball example into the modern Flash world, and it lays the groundwork for additional expansion in the next couple of chapters. With Mover implemented, the authors tackle inheritance by creating a Bouncer class with specialized functionality and a Gravity class to help reinforce the idea.
A short chapter on polymorphism goes on a bit of a tangent. The authors move away from the Mover classes, and polymorphism is presented differently. First, the basics are explained using body states such as hunger, boredom, and tiredness. It's interesting to see the idea of interfaces shown without them actually being introduced yet. That happens in the next chapter. I almost wonder if perhaps these examples should have been used earlier. The reader may consider it a nice break from the coding, or it may be confusing. When interfaces are truly introduced, you jump back into the Mover project and implement IMovable, IBounceable, and IGravity. With the previous movement classes, the code changes very little to include the interfaces.
The authors near the end of the first half of the book with their introduction to design patterns. Patterns offer great, tested solutions to programming problems. They're like frameworks that help you build your projects quicker, and they help you and others maintain your code more easily. Unfortunately, if you've already learned a bit about common patterns used by Flash developers, such as MVC, Singletons, Decorators, and Observer, you might not pick up much addtional knowledge. I could be wrong, but I believe that Colin Moock's Essential Actionscript 2.0 covers the exact same patterns. Consider picking it up to hear a different author's perspective on the subject.
The first half draws to a close with a case study that uses all of the techniques covered in earlier chapters. The authors create an OOP-based Media Player that can load Flash SWFs, Video, and MP3 files. By combining design patterns, some of the classes created earlier, and all sorts of great new examples of classes and inheritance, the authors do a wonderful job of bringing everything full-circle. There's a good deal of code presented in this chapter, but each section includes a specific explanation. If you're just learning these concepts, I highly recommend running through this whole example in Flash to get it working. The best way to learn is to just jump in and do it.
The first half is mainly geared toward AS2 beginners, but the second half is aimed at more advanced developers. In the second half, the authors take a quick look at the MX Components Framework that comes with Flash, and they use the knowledge from the first part of the book to build their own framework. Chapter 14 outlines the core classes of the MX Framework, specifically MovieClip (from the native Flash classes), UIObject, UIComponent and View. This chapter mainly offers an introduction to the idea of a framework, and you'll later discover that the authors take some ideas from these base classes to use in their own design choices.
The authors start implementing some sound and style management classes in the next chapter. The goals for this framework aren't quite as generic as say, Adobe's Flex Framework, so the StyleFormat utility class that goes with StyleManager has some specific properties for things like borders, shadows, and fonts.
Chapter 16 lays the groundwork for user interface components. Like Flash's MX Framework, a UIObject class provides a common interface for use with all visual components. On the next layer, the authors implement a Block class which can be used with graphical assets. For instance, one Block might be used to skin a button component. Finally, they hope to finish up with a SimpleButton component. This chapter is one of the largest in the book and it contains a good deal of information, including integration with styles, graphics, events, states, and sounds. If you're planning on creating reusable components, you might want to study this section to help yourself understand their methods. Even if you don't use the authors' base classes, the process of component development should be beneficial. It's quite common in the Flash world to build your own components from scratch. Over the lifetime of Flash, many developers have discovered that no magic bullet exists in this area. You have to balance flexibility, file size, performance, and more.
With a component system in place, the authors dive into animations. I found this chapter very interesting because it included many examples of using inheritance versus composition. With inheritance, a subclass takes the properties and methods from its parent class. For example, a Volkswagon "is a" Car. On the other hand, composition means that a class contains an instance of another class. A Car "has a(n)" Engine. You start out by creating a base Animator class. Two more classes, Tweener and Mover inherit from Animator. Mover, interestingly enough, uses a Tweener to handle its animation. From an OOP perspective, this design re-enforces the concept of encapsulation covered in earlier chapters.
In Chapter 18, "Interrelationships and Interactions Between Components", the authors look into data binding, formatting, and validating. Unlike previous chapters, where they developed their own framework solutions from scratch, they're now using some of the classes that come with Flash out of the box. The section also includes browser interaction through Flash's ExternalInterface and interaction with the server through XML and web services.
The book finally reaches its end with another case study. This time, the authors build a timesheet application. You'll see a little UML again as the authors design the class structure. They'll make use of the Model-View-Controller design pattern again. It's a pretty complex little project, and you'll want to study it, and probably recreate it in Flash to understand it well. You should pick up some good nuggets of information, and its always useful to see how others develop their projects.
You won't find a better text to help you with your transition from timeline to classes. If you're more advanced, you'll find that this book is an enjoyable read that might give you some new ideas. As a final note, don't let it discourage you that this book uses Actionscript 2 and Flash 8. Focus on the object-oriented parts because it doesn't matter what language you use to get these concepts down. Good design is universal.

ISBN:1590596196