Sequencer.as

Summary
Sequencer.as
events
org.silex.core.SequencerSequencer class is a sequencer for SILEX sequences.
Variables
silex_ptrReference to silex main Api object (org.silex.core.Api).
Properties
lengthNumber of elements in elements_array + the _currentItem if any.
Variables
_currentItemItem representing the sequence being played.
Properties
currentItem
Variables
stateState of the sequencer.
elements_array
doInNextFrames_arrayStore the actions to be done on next frame.
Functions
SequencerConstructor.
removeAllRemove all elements except the sequence which is curently running.
addItemAdds an item to elements_array and starts the process (i.e.
playSequenceStarts the process.
pauseSequencePauses the process.
stopSequenceStops the process.
nextSequenceSkip to the next sequence.
onEnterFrameDispatch onEnterFrame event.
doInNFramesdo an action in a certain number of frames
doInNextFramedo an action in the next frame

events

org.silex.core.Sequencer

UIObject
org.silex.core.Sequencer

Sequencer class is a sequencer for SILEX sequences.  Each sequence starts when the previous one has ended.  At the end of a sequence, the corresponding callback function is called and the next sequence starts.  If an item was added to the sequencer with no sequence specifyed, the callback is called immediately after start and the next sequence starts. in the repository : /trunk/core/Sequencer.as

Version

1

Author

Alexandre Hoyau

Summary
Variables
silex_ptrReference to silex main Api object (org.silex.core.Api).
Properties
lengthNumber of elements in elements_array + the _currentItem if any.
Variables
_currentItemItem representing the sequence being played.
Properties
currentItem
Variables
stateState of the sequencer.
elements_array
doInNextFrames_arrayStore the actions to be done on next frame.
Functions
SequencerConstructor.
removeAllRemove all elements except the sequence which is curently running.
addItemAdds an item to elements_array and starts the process (i.e.
playSequenceStarts the process.
pauseSequencePauses the process.
stopSequenceStops the process.
nextSequenceSkip to the next sequence.
onEnterFrameDispatch onEnterFrame event.
doInNFramesdo an action in a certain number of frames
doInNextFramedo an action in the next frame

Variables

silex_ptr

private var silex_ptr: org.silex.core.Api

Reference to silex main Api object (org.silex.core.Api).

Properties

length

function get length():Number

Number of elements in elements_array + the _currentItem if any.  Read only.

Variables

_currentItem

private var _currentItem: Object

Item representing the sequence being played.  Has target, callback and autoEndDetection attributes.  Read only.

Properties

currentItem

function get currentItem():Object

Variables

state

var state: String

State of the sequencer.  State values are defined in silex_ptr.config class: - SEQUENCER_STATE_PLAY - SEQUENCER_STATE_PAUSE - SEQUENCER_STATE_STOP

See Also

org.silex.core.Constants

elements_array

var elements_array: Array

Stores the sequences and callbacks. elements_array is made of objects with these properties

  • target:MovieClip, the sequence
  • callback:Function, the callback function
  • autoEndDetection:Boolean, automatically detect the end of the sequence (last frame of target is reached)

doInNextFrames_array

var doInNextFrames_array: Array

Store the actions to be done on next frame.

Functions

Sequencer

function Sequencer(api: org.silex.core.Api)

Constructor.

removeAll

function removeAll()

Remove all elements except the sequence which is curently running.

addItem

function addItem(item: MovieClip,
callback: Function,
startCallback: Function,
autoEndDetection: Boolean)

Adds an item to elements_array and starts the process (i.e. calls play()) if it was stopped (i.e. if elements_array was empty / state is set to silex_ptr.config.SEQUENCER_STATE_STOP).

Parameters

itemthe sequence to be added
callbackthe function to call at the end

playSequence

function playSequence()

Starts the process.  Change state.  Dispatch start event.

pauseSequence

function pauseSequence()

Pauses the process.  Stop sequence.  Dispatch pause event.

stopSequence

function stopSequence()

Stops the process.  Change state.  Dispatch stop event.

nextSequence

function nextSequence()

Skip to the next sequence.  Call the callback function.  Dispatch change.  Remove the first element of elements_array.  If elements_array is empty, stop the process (i.e. call stop()).  Or else, start the next sequence (play it).

onEnterFrame

function onEnterFrame()

Dispatch onEnterFrame event.  Check if the running anim is at the end.  If yes, calls next().

doInNFrames

function doInNFrames(nFrames: Number,
callback: Function,
arguments_obj: Object)

do an action in a certain number of frames

doInNextFrame

function doInNextFrame(callback: Function,
arguments_obj: Object)

do an action in the next frame

private var silex_ptr: org.silex.core.Api
Reference to silex main Api object (org.silex.core.Api).
function get length():Number
Number of elements in elements_array + the _currentItem if any.
private var _currentItem: Object
Item representing the sequence being played.
function get currentItem():Object
var state: String
State of the sequencer.
var elements_array: Array
var doInNextFrames_array: Array
Store the actions to be done on next frame.
function Sequencer(api: org.silex.core.Api)
Constructor.
function removeAll()
Remove all elements except the sequence which is curently running.
function addItem(item: MovieClip,
callback: Function,
startCallback: Function,
autoEndDetection: Boolean)
Adds an item to elements_array and starts the process (i.e.
function playSequence()
Starts the process.
function pauseSequence()
Pauses the process.
function stopSequence()
Stops the process.
function nextSequence()
Skip to the next sequence.
function onEnterFrame()
Dispatch onEnterFrame event.
function doInNFrames(nFrames: Number,
callback: Function,
arguments_obj: Object)
do an action in a certain number of frames
function doInNextFrame(callback: Function,
arguments_obj: Object)
do an action in the next frame
This class is used to store all silex constants default values which may be overriden by getDynData function or by values passed to FLash in index.php with SetVariable.