Introduction to ActionScript 3.0/Introduction
ActionScript is the programming language used in Flash projects. This book is intended to help anyone, including those without programming experience, to learn ActionScript and programming in general.
Note that if you have programming experience, this book will be quite easy for you. Just learn the juicy syntax and standard library!
What this book does not aim to do edit
- This book is not about the production of Flash games or websites. The information presented in this book should be helpful for all novice Flash programmers, not just those who would like to create a game or interactive website.
- To learn more, get a more advanced book or check out the official ActionScript documentation.
Why learn AS3 instead of AS2? edit
Back in the AS2 days, it was often said that ActionScript's simplicity allows non-programmers to program. With AS3, the language has become a whole lot more complicated. However, AS3 has introduced many features that allows you to gain more wholesome programming experience, better-structured code, and in general produce faster and more powerful applications. These features include:
- Improved event handling. In AS2, event handlers were simply properties of objects. You didn't have to worry about event dispatching or event bubbling (and instead addressed parents). Very often, you didn't even have to worry about attaching event listeners. Not anymore. Now you have full control over the entire event-handling business!
- Improved standard library. In AS2, nested MovieClips were the centre of the universe. attachMovie and createEmptyMovieClip were used to attach MovieClips in other MovieClips. Although convenient, this led to numerous problems with code structured and the like.
- Mandatory data typing. In AS2, data typing was optional. This is not longer the case in AS3.
There are many more advantages, but we won't go into everything one by one. Let's just begin our adventures in AS3!
How is this book organised? edit
Good question! This book is organised into four sections, each with its own objective.
Section I: The Bare Basics of ActionScript edit
In the first section, we will explore the ActionScript language. If ActionScript were a human language, this section will teach you the basic grammar, function words and sentence structures of that language. We will explore ActionScript as an object-oriented language, create classes and so on.
Section II: The Building Blocks of an ActionScript application edit
Knowing the grammar and sentence structure of a language is not enough! We need to learn vocabulary: words and phrases that enrich our application. In this chapter, we will learn how to build an application with resources including graphics, sounds and text. We will also look at timing and Mathematics, etc.
Section III: ActionScript and the Outside World edit
Having created an awesome Flash application is great, but Flash should not be an isolated object. It should also interact with the user's computer, with other servers, with other languages, and so on. This section is all about Flash communicating with the outside world.
Section IV: Going Advanced edit
In this section, we will go into greater detail the things we've learnt in previous sections. We'll also learn how best to design our applications.