Access keys

ExtendedActionQueue

Kind of class: class
Inherits from: ActionQueue < Dispatcher
Author: Arthur Clemens
Classpath: org.asapframework.util.actionqueue.ExtendedActionQueue
File last modified: Thursday, 12 October 2006, 11:11:18
Extends ActionQueue with the following functions:
  • Looping: set a start and end point in a list of actions and loop through them
  • Wait for a message: the queue becomes a listener that pauses until a message is received; or continue a paused queue as soon as a message is received
  • Wait for a condition: the queue will pause until a condition is met, or continue as soon as the condition is met
Usage:
Create the queue as you would with ActionQueue:
var extendedQueue:ExtendedActionQueue = new ExtendedActionQueue();
Add advanced actions:
extendedQueue.setLoopStart();
extendedQueue.addAction( AQMove.move, loop_mc, 1, null, null, endx, null, Regular.easeOut );
extendedQueue.addAction( AQMove.move, loop_mc, 0.5, null, null, endx, endy, Regular.easeOut );
extendedQueue.setLoopEnd();
Add 'normal' actions:
extendedQueue.addAction( AQFade.fade, loop_mc, 1, null, 0 );
extendedQueue.run();
To do:
Check if addContinueOnMessage still works with quirky setInterval in AS2.0.
Events broadcast to listeners:
ActionQueueEvent with type: QUEUE_LOOP_STARTED
ActionQueueEvent with type: QUEUE_LOOP_REWOUND
ActionQueueEvent with type: QUEUE_LOOP_FINISHED

Constructor

ExtendedActionQueue

function ExtendedActionQueue (
inName:String)
Parameters:
inName:
 

Instance methods

addContinueOnCondition

function addContinueOnCondition (
inVariableToWatchOwner:Object, inVariableToWatchName:String, inCheckForValue:Object, inIntervalDuration:Number) : Void
Continues the (paused) queue when a condition is met.
Use this method when the queue is paused or occupied indefinitely.
This method makes use of org.asapframework.util.watch.Watcher.
Parameters:
inVariableToWatchOwner:
object that owns the variableToWatch variable; this can be _root for instance or some object
inVariableToWatchName :
variable or function that returns a variable
inCheckForValue :
value that the variableToWatch is measured against; a number or string for example
inIntervalDuration :
time duration between each check; duration in seconds
Usage note:
Watcher's shouldRepeat is automatically set to true: the variable is checked indefinitely until variableToWatch is equal to checkForValue, or until ActionQueue.skip is called.
Implementation note:
This action is inserted into the array 1 position before the last action, so this action will be evaluated before the (currently) last action is called.
Example:
This example halts the queue until 6 characters are typed into an InputField:
// Wait indefinitely ...
queue.addPause( 0 );	
// Until 6 characters are typed into the name field
// Check each tenth of a second
queue.addContinueOnCondition( _root.namefield, "length", 6, 0.1 );

addContinueOnMessage

function addContinueOnMessage (
inSender:Object, inMessage:String, inTimeOutDuration:Number, inTimedOutObject:Object, inTimedOutFunctionName:String) : Void
Continues a halted queue when a message is received. Use this method to break in on a continuous action, such as AQMethods with a duration of 0 (eternally).
You can set a timeout function that should be called in case the message is not sent in the given time period. If you want to pause the action queue until the message is received, use addPauseUntilMessage.
Parameters:
inSender :
object that will send the message
inMessage :
name of message
inTimeOutDuration :
in case of error, the time in seconds that a timeout function will be called
inTimedOutObject :
object owner of timeout function
inTimedOutFunctionName:
method name of timeout function
Usage note:
Be careful not to attach an object that does not listen to removeListener, like common movieclips, or the listener will persist and keep on sending messages.
Implementation note:
This action is inserted into array 1 position before the last action, so this action will be evaluated before the (currently) last action is called. After the message has been received, the queue removes itself as listener.

addPauseUntilCondition

function addPauseUntilCondition (
inVariableToWatchOwner:Object, inVariableToWatchName:String, inCheckForValue:Object, inIntervalDuration:Number) : Void
Makes the queue pause until a condition is met.
This method makes use of org.asapframework.util.watch.Watcher.
Parameters:
inVariableToWatchOwner:
object that owns the variableToWatch variable; this can be _root for instance or some object
inVariableToWatchName :
variable or function that returns a variable; for a function you must pass its name
inCheckForValue :
value that the variableToWatch is measured against
inIntervalDuration :
time duration between each check; duration in seconds
Usage note:
Watcher's shouldRepeat is automatically set to true: the variable is checked indefinitely until variableToWatch is equal to checkForValue, or until ActionQueue.skip is called.
Implementation note:
This action is inserted into array 1 position before the last action, so this action will be evaluated before the (currently) last action is called.
The queue will be paused automatically.

addPauseUntilMessage

function addPauseUntilMessage (
inSender:Object, inMessage:String, inTimeOutDuration:Number, inTimedOutObject:Object, inTimedOutFunctionName:String) : Void
Subscribes to an object (sender), then pauses the queue until the sender's message is received.
Parameters:
inSender :
object that will send the message
inMessage :
name of message
inTimeOutDuration :
in case of error, the time in seconds that a timeout function will be called
inTimedOutObject :
object owner of timeout function
inTimedOutFunctionName:
method name of timeout function
Usage note:
the object that sends the message must be known.
Implementation note:
This action is inserted into array 1 position before the last action, so this action will be evaluated before the (currently) last action is called.
To do:
Test if the queue removes itself as listener.

endLoop

function endLoop (
inShouldSkipToAfterLoop:Boolean) : Void
Stop looping the queue.
Parameters:
inShouldSkipToAfterLoop:
(optional) true: don't finish current loop, but go directly to the first action after setLoopEnd; default false is assumed: the actions in the current loop are finished first before calling the actions after setLoopEnd

setLoopEnd

function setLoopEnd (
) : Void
Marks the end of a loop.
Example:
var queue:ExtendedActionQueue = new ExtendedActionQueue("loop queue");
queue.setLoopStart();
// add methods
queue.setLoopEnd();
queue.run();

setLoopStart

function setLoopStart (
) : Void
Marks the beginning of a loop.
Example:
var queue:ExtendedActionQueue = new ExtendedActionQueue("loop queue");
queue.setLoopStart();
// add methods
queue.setLoopEnd();
queue.run();

toString

function toString (
) : String