Packageorg.goasap
Classpublic class PlayableBase
InheritancePlayableBase Inheritance flash.events.EventDispatcher
SubclassesGoItem, PlayableGroup, SequenceAdvance, SequenceBase

Optional top-level abstract base class for classes that implement the IPlayable interface.

[This section updated recently!]
PlayableBase extentes EventDispatcher and provides three general-purpose properties:

  1. A state getter, found in the IPlayable interface.
  2. A unique numerical playableID value for each instance. This property is a GoASAP convention that is not required by playable instances but is used in utility functions like PlayableGroup.getChildByID().
  3. A static _playRetainer property that can by used to store instances temporarily during play. This convention should be used with any playable item that does not add itself to GoEngine (a Sequence instance for example), to prevent garbage collection during play.


Note: GoASAP's IPlayable structure was simplified at version 0.5.0 and now differs slightly from the information found in the Friends of Ed book, "The Essential Guide to Open Source Flash Development". Please regard the following changes:

  1. The IPlayableBase interface has been removed from the GoASAP core. The state property was moved into the IPlayable interface, and the playableID property is now treated as an optional convention.
  2. The play-state constants (PLAYING, etc.) have been moved into a new class called PlayStates.
  3. This class, PlayableBase, is now treated as entirely optional.

See also

IPlayable
PlayStates


Public Properties
 PropertyDefined by
  playableID : *
An arbitrary id value for the convenient identification of any instance, automatically set to an instance count by this class.
PlayableBase
  state : String
[read-only] Returns a PlayStates constant.
PlayableBase
Protected Properties
 PropertyDefined by
  _playRetainer : Dictionary
[static] Memory-management: playable items that do not add themselves to GoEngine should use this property to store references to themselves during play.
PlayableBase
Public Methods
 MethodDefined by
  
Throws an InstanceNotAllowedError if directly instantiated, also sets a default playableID to an instance count number.
PlayableBase
  
toString():String
Appends the regular toString value with the instance's playableID.
PlayableBase
Property detail
playableIDproperty
playableID:*  [read-write]

An arbitrary id value for the convenient identification of any instance, automatically set to an instance count by this class.

Implementation
    public function get playableID():*
    public function set playableID(value:*):void
_playRetainerproperty 
protected static var _playRetainer:Dictionary

Memory-management: playable items that do not add themselves to GoEngine should use this property to store references to themselves during play.

This prevents instance from getting garbage-collected during play. For an example, see SequenceBase's start and stop methods. This step is not necessary if GoEngine.addItem() is used by the item, since in that case GoEngine keeps a live reference during play.

This property is a convenience. You can mimic the technique using any static property, to temporarily protect the object from garbage collection.

See also

stateproperty 
state:String  [read-only]

Returns a PlayStates constant.

Implementation
    public function get state():String

See also

Constructor detail
PlayableBase()constructor
public function PlayableBase()

Throws an InstanceNotAllowedError if directly instantiated, also sets a default playableID to an instance count number.

Method detail
toString()method
public override function toString():String

Appends the regular toString value with the instance's playableID.

Returns
String — String representation of this instance.