Packageorg.goasap
Classpublic class GoEngine

Provides update calls to IUpdatable instances on their specified pulseInterval.

Using these Docs

Protected methods and properties have been excluded in almost all cases, but are documented in the classes. Exceptions include key protected methods or properties that are integral for writing subclasses or understanding the basic mechanics of the system. Many Go classes can be used as is without subclassing, so the documentation offers an uncluttered view of their public usage.

Introduction to Go [This section updated recently!]

The Go ActionScript Animation Platform ("GOASAP") is a lightweight, portable set of generic base classes for buliding AS3 animation tools. It provides structure and core functionality, but does not define the specifics of animation-handling classes like tweens.

GoASAP could be broken up into the following general layers:

  • Compatibility: In general, this layer can be used in about any animation system. GoEngine, GoEvent, PlayStates and IPlayable.
  • Items: Base classes for utilities and animation items: PlayableBase, GoItem, LinearGo and PhysicsGo.
  • Utilities: You can write utility classes to manage items. Go ships with a few common ones: a parallel item class called PlayableGroup, and several Sequence classes.
  • Automation/Management: GoEngine provides a simple, centralized and fully extensible way for you to automate any time-based process and manage multiple items at once.

GoASAP provides an intentionally loose standard, in that it does not intend to limit the possibilities of what can be built with it. Its primary benefits are compatibility and synchronicity between animation systems, absolute extensibility into any time-based process, and a much faster and easier way to build your own animation tools from scratch.

Important: Store your custom Go classes in a package bearing your own classpath, not in the core package! This will help avoid confusion with other authors' work.

You may modify any class in the goasap package to suit your project's needs. Your input is valuable! Please join the mailing list and share your Go-based animation tools at the GoPlayground repository. The GoASAP initiative is led by Moses Gunesch at MosesSupposes.com. Please visit the Go website for more information.

GoEngine [This section updated recently!]

GoEngine sits at the center of the Go system, and along with the IUpdatable interface is the only required element for using GoASAP. GoEngine manages tightly synchronized item lists, since updating items in groups enhances efficiency. An advantage of GoASAP is that wildly different animation systems can be used together in the same project. Their synchronous updates will remain as efficient as possible, instead of fighting one another for processor cycles.

GoEngine's default pulse rate is ENTER_FRAME which yields the smoothest processing in the Flash Player. However, it does not run on any one specific pulse. Instead, any object that is IUpdatable may specify its own pulse rate, and items with matching pulses are automatically grouped into update lists for efficiency. On a fine-tuning level, GoEngine uses a few other tricks to try and provide the tightest possible visual synchronization for larger batches of animation items. It passes the clock time at the start of each update cycle to each item in that list, which can be used in place of realtime to counteract any offset due to processing lag during the cycle. Additionally, items that get added during an update cycle are queued until the next update.

GoASAP's management layer is made up of three interfaces that are referenced by GoEngine: IManager, ILiveManager and IManageable. Managers are always optional in GoASAP, and are only activated by calling GoEngine.addManager(). Managers can automate processes as items are added and removed, such as the included OverlapMonitor class which prevents property conflicts between items, or they can automate "live" processes that occur on each pulse. No live managers are included but an example might be a class that re-renders a 3D viewport after all 3D tweens have been processed. This can of course be done without a custom manager, but by using GoASAP you gain a unique ability to very cleanly and simply tie any custom routines in your project right into your animation processing, in perfect sync and with maximum efficiency.

{In the game of Go, the wooden playing board, or Goban, features a grid on which black & white go-ishi stones are laid at its intersections.}

See also

LinearGo
IManager


Public Methods
 MethodDefined by
  
addItem(item:IUpdatable):Boolean
[static] Adds an IUpdatable instance to an update-queue corresponding to the item's pulseInterval property.
GoEngine
  
addManager(instance:IManager):void
[static] Enables the extending of this class' functionality with a tight coupling to an IManager.
GoEngine
  
clear(pulseInterval:Number):uint
[static] Removes all items and resets the engine, or removes just items running on a specific pulse.
GoEngine
  
getCount(pulseInterval:Number):uint
[static] Retrieves number of active items in the engine or active items running on a specific pulse.
GoEngine
  
getManager(className:String):IManager
[static]
GoEngine
  
getPaused():Boolean
[static]
GoEngine
  
hasItem(item:IUpdatable):Boolean
[static] Test whether an item is currently stored and being updated by the engine.
GoEngine
  
removeItem(item:IUpdatable):Boolean
[static] Removes an item from the queue and removes its pulse timer if the queue is depleted.
GoEngine
  
removeManager(className:String):void
[static] Unregisters any manager set in addManager.
GoEngine
  
setPaused(pause:Boolean = true, pulseInterval:Number):uint
[static] Pauses or resumes all animation globally by suspending processing, and calls pause() or resume() on each item with those methods.
GoEngine
Public Constants
 ConstantDefined by
  ENTER_FRAME : int = -1
[static] A pulseInterval that runs on the player's natural framerate, which is often most efficient.
GoEngine
  INFO : String = "GoASAP 0.5.0 (c) Moses Gunesch, MIT Licensed."
[static]
GoEngine
Method detail
addItem()method
public static function addItem(item:IUpdatable):Boolean

Adds an IUpdatable instance to an update-queue corresponding to the item's pulseInterval property.

Parameters
item:IUpdatable — Any object implementing IUpdatable that wishes to receive update calls on a pulse.

Returns
Boolean — Returns false only if this item was already in the engine under the same pulse. (If an existing item is added but the pulseInterval has changed it will be removed, re-added, and true will be returned.)

See also

addManager()method 
public static function addManager(instance:IManager):void

Enables the extending of this class' functionality with a tight coupling to an IManager.

Tight coupling is crucial in such a time-sensitive context; standard events are too asynchronous. All items that implement IManageable are reported to registered managers as they add and remove themselves from GoEngine.

Managers normally act as singletons within the Go system (which you are welcome to modify). This method throws a DuplicateManagerError if an instance of the same manager class is already registered. Use a try/catch block when calling this method if your program might duplicate managers, or use getManager() to check for prior registration.

Parameters
instance:IManager — An instance of a manager you wish to add.

See also

clear()method 
public static function clear(pulseInterval:Number):uint

Removes all items and resets the engine, or removes just items running on a specific pulse.

Parameters
pulseInterval:Number — Optionally filter by a specific pulse such as ENTER_FRAME or a number of milliseconds.

Returns
uint — The number of items successfully removed.

See also

getCount()method 
public static function getCount(pulseInterval:Number):uint

Retrieves number of active items in the engine or active items running on a specific pulse.

Parameters
pulseInterval:Number — Optionally filter by a specific pulseInterval such as ENTER_FRAME or a number of milliseconds.

Returns
uint — Number of active items in the Engine.
getManager()method 
public static function getManager(className:String):IManager

Parameters
className:String — A string naming the manager class, such as "OverlapMonitor".

Returns
IManager — The manager instance, if registered.

See also

getPaused()method 
public static function getPaused():Boolean

Returns
Boolean — The paused state of engine.

See also

hasItem()method 
public static function hasItem(item:IUpdatable):Boolean

Test whether an item is currently stored and being updated by the engine.

Parameters
item:IUpdatable — Any object implementing IUpdatable

Returns
Boolean — Whether the IUpdatable is in the engine
removeItem()method 
public static function removeItem(item:IUpdatable):Boolean

Removes an item from the queue and removes its pulse timer if the queue is depleted.

Parameters
item:IUpdatable — Any IUpdatable previously added that wishes to stop receiving update calls.

Returns
Boolean — Returns false if the item was not in the engine.

See also

removeManager()method 
public static function removeManager(className:String):void

Unregisters any manager set in addManager.

Parameters
className:String — A string naming the manager class, such as "OverlapMonitor".

See also

setPaused()method 
public static function setPaused(pause:Boolean = true, pulseInterval:Number):uint

Pauses or resumes all animation globally by suspending processing, and calls pause() or resume() on each item with those methods.

The return value only reflects how many items had pause() or resume() called on them, but the GoEngine.getPaused() state will change if any pulses are suspended or resumed.

Parameters
pause:Boolean (default = true) — Pass false to resume if currently paused.
 
pulseInterval:Number — Optionally filter by a specific pulse such as ENTER_FRAME or a number of milliseconds.

Returns
uint — The number of items on which a pause() or resume() method was called (0 doesn't necessarily reflect whether the GoEngine.getPaused() state changed, it may simply indicate that no items had that method).

See also

Constant detail
ENTER_FRAMEconstant
public static const ENTER_FRAME:int = -1

A pulseInterval that runs on the player's natural framerate, which is often most efficient.

INFOconstant 
public static const INFO:String = "GoASAP 0.5.0 (c) Moses Gunesch, MIT Licensed."