ActionScript 3

Topics related to ActionScript 3:

Getting started with ActionScript 3

Singleton Pattern

The singleton pattern has the goal to allow only one instance of a class to exists at any given time.

Preventing the direct instantiation via constructor is usually prevent by making it private. However, this is not possible in As3 and thus other ways to control the number of instances have to be used.

Random Value Generation

Responsive Application Design

Working With Display Objects

The display list is actually a tree, and is visualized with depth first algorithm. Any object listed earlier will be displayed earlier, and might be obscured by objects listed later. All techniques that can be used against a tree can be applied to working with display list.

Loading External Files

There are some cases where your application cannot manipulate the contents of assets loaded from an external resource (e.g. transform images). I can't remember for certain what they are, but I am fairly sure it's related to cross domain content loading.

Display List Lifecycle

Frame-based animation in Flash and AIR implement the following lifecycle:

  • Event.ENTER_FRAME is dispatched
  • Constructor code of children display objects are executed
  • Event.FRAME_CONSTRUCTED is dispatched
  • Frame actions in the MovieClip symbol is executed
  • Frame actions in children MovieClip symbols are executed
  • Event.EXIT_FRAME is dispatched
  • Event.RENDER is dispatched

Sending and Receiving Data From Servers

Working with numerical values

Working with Events

Events are pieces of data that a program can create, exchange and react upon. The asynchronous event flow is dispatched over display list by Flash engine as a reaction on external events, such as mouse movements or another frame being displayed. Every other event flow and all event processing is synchronous, so if a piece of code has generated an event, all reactions on it are processed before the next line of code is executed, also if there are several listeners of an event, all of them would have run before the next event could be processed.

There are several major events associated with Flash programming. Event.ENTER_FRAME is generated before Flash draws another frame, it signals the entire display list to prepare to be drawn, and can be used as a synchronous timer. MouseEvent.CLICK and its siblings can be used to receive mouse input from the user, and TouchEvent.TOUCH_TAP is an analogue for touch screens. KeyboardEvent.KEY_DOWN and KEY_UP provide means to receive user input from the keyboard, however, their usage in mobile department is almost impossible due to devices having no physical keyboard. Finally, Event.ADDED_TO_STAGE is dispatched once a display object receives access to stage, and is included in the global display list that receives the entirety of events that can bubble up and down the display list.

Most events in Flash are component specific. If you are designing your own component that will use Flash events, use a flash.events.Event descendant class and its static String properties to create your component's event set.

Working with Date and Time

Object Oriented Programming

Working with Sound

Understanding the "Error 1009: Cannot access a property or method of a null object reference"

The dreaded and often asked "Error 1009: Cannot access a property or method of a null object reference" is a signal that some of the data appears null, but is tried to be used as a populated object. There are pretty many types of issues that can cause this behavior, and each one should be tested against the code where the error arised.

Optimizing Performance

Working with Video

Working with Timeline

Working with Timers

Types

Drawing Bitmaps

Working with Geometry

Bitmap Manipulation and Filtering

Game Development Basics

Binary data

Using the Proxy Class