Package | impression.players.sequencers |
Class | public class AudioSequencer |
Inheritance | AudioSequencer ![]() ![]() |
position
and
complete
persisted properties. If the position of the sound file is greater than the value of
the position
persisted property, and the complete
persisted property value is
false
, the AudioSequencer will dispatch a CueEvent.CUE
event to notify the shell
that an action should occur.
Like all sequencer classes, the exact data and behavior is project-defined. The AudioSequencer class provides only the minimum functionality needed to perform actions synchronized with an audio file.
Property | Defined By | ||
---|---|---|---|
![]() | alwaysCheckComplete : Boolean
Specifies how the object should handle storyboard completion. | BasePlayer | |
context : SoundLoaderContext
The SoundLoaderContext to use with the sequencer. | AudioSequencer | ||
interval : Number
The frequency, in milliseconds, that the sequencer will use to check the
child elements of the current storyboard. | AudioSequencer | ||
![]() | narrationComplete : Boolean
Indicates whether narration has finished playing. | BasePlayer | |
position : Number
Returns or sets the position in the audio file. | AudioSequencer | ||
resolver : AssetResolver
The AssetResolver to use to request audio files. | AudioSequencer | ||
soundTransform : SoundTransform
The SoundTransform object to use when playing an audio file. | AudioSequencer | ||
status : String [read-only]
The current status of the sequencer. | AudioSequencer | ||
storyboard : Storyboard [override]
Specifies the storyboard for the player. | AudioSequencer | ||
useLastPosition : Boolean
Indicates whether or not the last position should be used to begin
audio playback of a previously loaded storyboard. | AudioSequencer |
Method | Defined By | ||
---|---|---|---|
AudioSequencer(resolver:AssetResolver = null, context:SoundLoaderContext = null, transform:SoundTransform = null)
Creates a new instance of the AudioSequencer. | AudioSequencer | ||
![]() | checkForComplete():void
Causes the player to examine the completion criteria for the current storyboard. | BasePlayer | |
getStoryboardState(sb:Storyboard):String [static] | AudioSequencer | ||
pause():void
Pauses or resumes playback of the audio file. | AudioSequencer | ||
play():void
Begins or resumes playback of the audio file. | AudioSequencer | ||
resetStoryboard(sb:Storyboard):void [static]
Removes all properties set by the player. | AudioSequencer | ||
setStoryboardState(sb:Storyboard, state:String):void [static] | AudioSequencer | ||
stop():void
Stops playback of the audio file and sets the position property value to 0. | AudioSequencer |
Method | Defined By | ||
---|---|---|---|
![]() | initializeStoryboard():void
Initializes the storyboard. | BasePlayer | |
loadStoryboard():void [override]
Loads the storyboard. | AudioSequencer | ||
[override]
Removes known completion criteria from the CompleteRemaining storyboard persisted property. | AudioSequencer | ||
unloadStoryboard():void [override]
Performs cleanup actions when a storyboard is unloaded. | AudioSequencer |
Event | Summary | Defined By | ||
---|---|---|---|---|
![]() | Dispatched when the BasePlayer needs to resolve completion criteria beyond those defined for the class. | BasePlayer | ||
![]() | Dispatched when a storyboard is marked as complete. | BasePlayer | ||
Dispatched when the sequencer begins to load external assets. | AudioSequencer | |||
Dispatched when all external assets have finished loading. | AudioSequencer | |||
Dispatched when a sequencer element should be processed. | AudioSequencer | |||
![]() | Dispatched after a storyboard is initialized. | BasePlayer | ||
![]() | Dispatched when storyboard loading is complete. | BasePlayer | ||
![]() | Dispatched when a storyboard is loaded, but before any processing occurs. | BasePlayer | ||
Dispatched when the status of the sequencer changes. | AudioSequencer | |||
Dispatched when the audio has finished playing. | AudioSequencer | |||
Dispatched when the internal timer fires. | AudioSequencer | |||
![]() | Dispatched before a storyboard is unloaded. | BasePlayer |
context | property |
context:SoundLoaderContext
The SoundLoaderContext to use with the sequencer. This object is passed to the constructor of the internal SoundEx object when an audio file is loaded.
public function get context():SoundLoaderContext
public function set context(value:SoundLoaderContext):void
interval | property |
interval:Number
The frequency, in milliseconds, that the sequencer will use to check the child elements of the current storyboard.
The default value is 100
.
public function get interval():Number
public function set interval(value:Number):void
position | property |
position:Number
Returns or sets the position in the audio file.
When this property value is set, and the status
property value is SequencerStatusTypes.PLAYING
,
playback stops and the status is changed to SequencerStatusTypes.PAUSED
. If the status
property
value is SequencerStatusTypes.STOPPED
, SequencerStatusTypes.EOF
, or SequencerStatusTypes.LOAD_COMPLETE
,
the status is changed to SequencerStatusTypes.PAUSED
. If the status is not one of the values listed above, an
error is thrown.
public function get position():Number
public function set position(value:Number):void
ArgumentError — cannot set position when status is [status] (ArgumentError).
| |
RangeError — position cannot be set < 0 (RangeError).
|
resolver | property |
resolver:AssetResolver
The AssetResolver to use to request audio files. When this value is set to a non-null
value,
the sequencer registers itself with the resolver as an owner, and all content requested is requested using itself
as the owner.
If the sequencer is currently loading content, all load actions in progress will be cancelled when
this property is set. When removing the references to an existing resolver, the sequencer will unregister itself
as an owner. If the new property value is not null
, the sequencer will register itself as an owner.
public function get resolver():AssetResolver
public function set resolver(value:AssetResolver):void
soundTransform | property |
soundTransform:SoundTransform
The SoundTransform object to use when playing an audio file. This object is passed to the internal SoundEx object.
public function get soundTransform():SoundTransform
public function set soundTransform(value:SoundTransform):void
status | property |
status:String
[read-only]
The current status of the sequencer. This value will be one of the SequencerStatusTypes
constant values.
public function get status():String
See also
storyboard | property |
storyboard:Storyboard
[override] Specifies the storyboard for the player.
If null
is passed, the current storyboard is
unloaded, the StoryboardEvent.UNLOAD
event is dispatched, and
no further action occurs.
If a non- null
storyboard object is passed, the following actions
occur, in order:
null
, the StoryboardEvent.UNLOAD
event is dispatched. If the event is not cancelled, the current storyboard is unloaded. If the event is cancelled, further processing stops.StoryboardEvent.LOAD_START
event is dispatched. If the event is not cancelled, the new storyboard is associated with the player. If the event is cancelled, further processing stops and the value of this property is set to null
. Initialized
persisted property is false
, the storyboard is initialized and the StoryboardEvent.INITIALIZE
event is dispatched.contentLoadBegin
event is dispatched.contentLoadEnd
event is dispatched, followed by the loadComplete
event.loadComplete
event was dispatched, the checkForComplete()
method is invoked. If all completion criteria have
been met, the complete
event is dispatched.Note that the AudioSequencer may raise one or move SequencerStatusEvent.STATUS_CHANGED
events during storyboard load.
If the resolver
property is null
, the audio file will not be rendered, and
no error will occur.
public function get storyboard():Storyboard
public function set storyboard(value:Storyboard):void
See also
useLastPosition | property |
useLastPosition:Boolean
Indicates whether or not the last position should be used to begin audio playback of a previously loaded storyboard.
The default value is false
.
public function get useLastPosition():Boolean
public function set useLastPosition(value:Boolean):void
AudioSequencer | () | Constructor |
public function AudioSequencer(resolver:AssetResolver = null, context:SoundLoaderContext = null, transform:SoundTransform = null)
Creates a new instance of the AudioSequencer.
Parametersresolver:AssetResolver (default = null ) — The AssetResolver to use to request external assets.
| |
context:SoundLoaderContext (default = null ) — The SoundLoaderContext object to be associated with the loader used to open the audio file.
| |
transform:SoundTransform (default = null ) — The SoundTransform object to be used with the sound channel used by the audio file.
|
getStoryboardState | () | method |
public static function getStoryboardState(sb:Storyboard):String
Parameters
sb:Storyboard |
String |
loadStoryboard | () | method |
override protected function loadStoryboard():void
Loads the storyboard.
This method is invoked by the storyboard
property set method. Unlike other player classes, this
method is invoked even if a null
storyboard object is loaded. This method is invoked after
initialization (if needed) occurs.
When loading a storyboard, the AudioSequencer performs the following actions:
alwaysCheckComplete
property value is true
, each child element's Complete
persisted property value is set to false
.storyboard
property value is null
, the status
property value is set to
SequencerStatusTypes.NO_STORYBOARD
, the SequencerStatusEvent.STATUS_CHANGED
event is dispatched,
and further processing stops.children
collection of the storyboard are sorted by the value of each element's
position
persisted property, in ascending order.resolver
property value is null
, the status
property value is set to
SequencerStatusTypes.NO_RESOLVER
, the SequencerStatusEvent.STATUS_CHANGED
event is dispatched,
the StoryboardEvent.LOAD_COMPLETE
event is dispatched, the checkForComplete()
method is invoked,
and further processing stops.status
property value is set to SequencerStatusTypes.EMPTY
,
the SequencerStatusEvent.STATUS_CHANGED
event is dispatched, the StoryboardEvent.LOAD_COMPLETE
event
is dispatched, the checkForComplete()
method is invoked, and further processing stops.See also
pause | () | method |
public function pause():void
Pauses or resumes playback of the audio file.
If the status
property value is SequencerStatusTypes.PAUSED
, this method
resumes playback of the audio file from the value of position
. If the status
property value is one of the following, this method pauses playback of the audio file at the current position:
SequencerStatusTypes.PLAYING
SequencerStatusTypes.LOAD_COMPLETE
For all other status
property values, invoking this method has no effect.
If this method pauses playback, the player will dispatch the SequencerStatusEvent.STATUS_CHANGE
event.
See also
play | () | method |
public function play():void
Begins or resumes playback of the audio file.
If the status
property value is SequencerStatusTypes.PAUSED
, this method
resumes playback of the audio file from the value of position
. If the status
property value is one of the following, this method begins playback of the audio file from the beginning:
SequencerStatusTypes.STOPPED
SequencerStatusTypes.EOF
SequencerStatusTypes.LOAD_COMPLETE
For all other status
property values, invoking this method has no effect.
If this method begins playback, the player will dispatch the SequencerStatusEvent.STATUS_CHANGE
event.
See also
removeCompleteRemainingCriteria | () | method |
override protected function removeCompleteRemainingCriteria():void
Removes known completion criteria from the CompleteRemaining
storyboard persisted property.
This method is invoked by the checkForComplete()
method if the value of the storyboard
property is not null
, and the complete
event has not been dispatched since the storyboard
was loaded.
In addition to the substrings processed by the BasePlayer, the AudioSequencer will remove the following substrings from the completeRemaining
persisted property:
Substring | Meaning |
---|---|
commandObjectsComplete; | All child elements have a Complete persisted property value of true . |
See also
resetStoryboard | () | method |
public static function resetStoryboard(sb:Storyboard):void
Removes all properties set by the player.
Note that this method also removes interim completion properties used by the player, but not necessarily set by the player.
Parameters
sb:Storyboard — The storyboard to remove properties from.
This method removes the following properties from a storyboard:
This method removes the following properties from each ChildElement in the storyboard's
|
setStoryboardState | () | method |
public static function setStoryboardState(sb:Storyboard, state:String):void
Parameters
sb:Storyboard | |
state:String |
stop | () | method |
public function stop():void
Stops playback of the audio file and sets the position
property value to 0
.
If the status
property value is not SequencerStatusTypes.PAUSED
,
SequencerStatusTypes.PLAYING
, SequencerStatusTypes.EOF
, or
SequencerStatusTypes.LOAD_COMPLETE
, invoking this method has no effect.
If this method stops playback, the player will dispatch the SequencerStatusEvent.STATUS_CHANGE
event.
See also
unloadStoryboard | () | method |
override protected function unloadStoryboard():void
Performs cleanup actions when a storyboard is unloaded.
This method is invoked by the storyboard
property set method when the current value of the property
is not null
and the unload
event has not been cancelled.
When unloading a storyboard, the AudioSequencer performs the following actions:
cancelOwnerTransaction()
method is invoked.closeAllOf()
method.position
property is saved to the storyboard's LastPosition
persisted property.See also
contentLoadBegin | Event |
impression.events.StoryboardEvent
impression.events.StoryboardEvent.CONTENT_LOAD_BEGIN
Dispatched when the sequencer begins to load external assets.
This event is dispatched when the storyboard
property
is set to a non-null
value.
This event will occur if any external assets are defined, even if
they cannot be loaded. This event is dispatched when the resolverInfo
object whose owner
property value is the player dispatches
its beginTransaction
event.
Property | Value |
---|---|
bubbles | false |
cancelable | false ; there is no default behavior to cancel. |
currentTarget | The object that is actively processing the Event object with an event listener. |
target | The object that raised the event. |
sb | The Storyboard object assigned to the target. |
contentLoadEnd | Event |
impression.events.StoryboardEvent
impression.events.StoryboardEvent.CONTENT_LOAD_END
Dispatched when all external assets have finished loading.
This event will occur if any external assets are defined, even if
they cannot be loaded. This event is dispatched when the resolverInfo
object whose owner
property value is the player dispatches
its endTransaction
event.
Property | Value |
---|---|
bubbles | false |
cancelable | false ; there is no default behavior to cancel. |
currentTarget | The object that is actively processing the Event object with an event listener. |
target | The object that raised the event. |
sb | The Storyboard object assigned to the target. |
cue | Event |
impression.events.CueEvent
impression.events.CueEvent.CUE
Dispatched when a sequencer element should be processed.
This event is dispatched when the sequencer's status
property is SequencerStatusTypes.PLAYING
and a child element object's Position
persisted property value is <= the value of the sequencer's
position
property value and the element's Complete
persisted property value is false
.
A CueEvent.CUE
event is dispatched for each child element that meets this criteria.
Note that the child elements in the storyboard's children
collection are sorted by the value of their
Position
persisted property value each time the storyboard is loaded; this ensures that the cue events occur
"in order".
Property | Value |
---|---|
bubbles | false |
cancelable | false ; there is no default behavior to cancel. |
currentTarget | The object that is actively processing the Event object with an event listener. |
target | The object that raised the event. |
sb | The Storyboard object assigned to the target. |
currentPosition | The value of the position property of the ChildElement object that triggered the event. |
childElement | The ChildElement object that triggered the event. |
complete | Indicates whether or not the childElement parameter's complete
persisted property should be set to true when the event returns. |
sequencerStatusChanged | Event |
impression.events.SequencerStatusEvent
impression.events.SequencerStatusEvent.STATUS_CHANGED
Dispatched when the status of the sequencer changes.
The SequencerStatusEvent.STATUS_CHANGED constant defines the value of the type property of a status changed event object. This event has the following properties:Property | Value |
---|---|
bubbles | false |
cancelable | false ; there is no default behavior to cancel. |
currentTarget | The object that is actively processing the Event object with an event listener. |
target | The object that raised the event. |
sb | The Storyboard object assigned to the target. |
status | The status of the sequencer. |
text | Additional information about the status. |
soundComplete | Event |
flash.events.Event
flash.events.Event.SOUND_COMPLETE
Dispatched when the audio has finished playing.
timer | Event |
flash.events.TimerEvent
flash.events.TimerEvent.TIMER
Dispatched when the internal timer fires. This event is dispatched when the sequencer's status
property is
SequencerStatusTypes.PLAYING
, before any CueEvent.CUE
events are dispatched.