ActionScript 3 is the programming language for the Adobe Flash Player and Adobe AIR runtime environments. It is object-oriented ECMAScript based language used primary for native application development on desktop (Windows/Mac) and mobile (iOS/Android) devices.
Adobe learning resources: http://www.adobe.com/devnet/actionscript/learning.html
History and more details: https://en.wikipedia.org/wiki/ActionScript
Online documentation on classes and reference: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/package-detail.html
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.
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.
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.
Frame-based animation in Flash and AIR implement the following lifecycle:
Event.ENTER_FRAME
is dispatchedEvent.FRAME_CONSTRUCTED
is dispatchedMovieClip
symbol is executedMovieClip
symbols are executedEvent.EXIT_FRAME
is dispatchedEvent.RENDER
is dispatchedEvents 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.
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.