Packagecom.pbking.app.command
Classpublic class ThreadedCommand
InheritanceThreadedCommand Inheritance AsyncCommand Inheritance AppCommand Inheritance flash.events.EventDispatcher
ImplementsIRunnable, IThread

This threaded command is based on the Ender framework. Is is only PSUDO-threaded. Your logic should happen in interations and you classes should handle all of the information that should be persisted across the iterations. The class does have some promitive optimization logic that will help set the number of iterations that happen on each run. Unlike the rest of the commands your execution logic should be placed in an overridden handleRun() method. In this method should be the logic for ONE iteration. When your iteration is complete call the yield() method to return control to the flash player (to allow screen updates, etc). When yeld is called you can optionall pass a percentComplete value (if you know). A progressEvent will be dispatched from this event every time yield is called. It's kinda tricky to use this command so a good example is needed. Using this command WILL lengthen the total amount of time it takes to process something. But allowing the Flash player to continue processing is necessary during long calculations & parsings.



Public Properties
 PropertyDefined by
  autoOptimizeIterations : Boolean = true
ThreadedCommand
 Inheritedcomplete : Boolean
AsyncCommand
 Inheritedexecuting : Boolean
AsyncCommand
  iterationsPerRun : int = 1000
ThreadedCommand
 InheritedLOGGING_CATEGORY : String = "pbking.command"
[static]
AppCommand
 InheritedMAXIMUM_UNDO_HISTORY : int = 100
[static]
AppCommand
  optimalRunLength : int = 500
[static]
ThreadedCommand
  optimizationAccuracy : int = 50
[static]
ThreadedCommand
  priority : int
ThreadedCommand
  runnable : IRunnable
[read-only]
ThreadedCommand
 Inheritedsuccess : Boolean
AsyncCommand
 Inheritedundoable : Boolean
AppCommand
 Inherited_undoableCommands : Array
[static]
AppCommand
 InheritedundoableCommands : Array
[static]
AppCommand
Protected Properties
 PropertyDefined by
 InheritedexecuteImmediately : Boolean
AppCommand
  iterationCount : int = 0
ThreadedCommand
 Inheritedlogger : PBLogger
AppCommand
  _priority : int = 300
ThreadedCommand
  runLength : int
ThreadedCommand
  runStartTime : int
ThreadedCommand
 Inherited_success : Boolean = true
AsyncCommand
 Inherited_undoable : Boolean = false
AppCommand
Public Methods
 MethodDefined by
  
ThreadedCommand(executeImmediately:Boolean = false)
ThreadedCommand
 Inherited
addCallback(func:Function):void
AsyncCommand
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
AsyncCommand
 Inherited
execute():void
AsyncCommand
 Inherited
AsyncCommand
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
AsyncCommand
  
run():void
ThreadedCommand
  
start():void
ThreadedCommand
  
stop():void
ThreadedCommand
 Inherited
undo():void
Execute a command's undo logic.
AppCommand
 Inherited
[static]
AppCommand
  
yield(percentComplete:Number = 0):void
ThreadedCommand
Protected Methods
 MethodDefined by
 Inherited
[static]
AppCommand
  
ThreadedCommand
  
handleRun():void
ThreadedCommand
 Inherited
handleUndo():void
AppCommand
  
onComplete():void
ThreadedCommand
Events
 EventSummaryDefined by
 Inherited  AsyncCommand
Public Constants
 ConstantDefined by
 InheritedCALLBACK : String = "callbackEvent"
AsyncCommand
Property detail
autoOptimizeIterationsproperty
public var autoOptimizeIterations:Boolean = true
iterationCountproperty 
protected var iterationCount:int = 0
iterationsPerRunproperty 
public var iterationsPerRun:int = 1000
optimalRunLengthproperty 
public static var optimalRunLength:int = 500
optimizationAccuracyproperty 
public static var optimizationAccuracy:int = 50
_priorityproperty 
protected var _priority:int = 300
priorityproperty 
priority:int  [read-write]Implementation
    public function get priority():int
    public function set priority(value:int):void
runLengthproperty 
protected var runLength:int
runnableproperty 
runnable:IRunnable  [read-only]Implementation
    public function get runnable():IRunnable
runStartTimeproperty 
protected var runStartTime:int
Constructor detail
ThreadedCommand()constructor
public function ThreadedCommand(executeImmediately:Boolean = false)Parameters
executeImmediately:Boolean (default = false)
Method detail
handleExecution()method
protected override function handleExecution():void
handleRun()method 
protected function handleRun():void
onComplete()method 
protected override function onComplete():void
run()method 
public function run():void
start()method 
public function start():void
stop()method 
public function stop():void
yield()method 
public function yield(percentComplete:Number = 0):voidParameters
percentComplete:Number (default = 0)