ProcessGroup

Kind of class:public class
Package:org.casalib.process
Inherits from:Process < RemovableEventDispatcher < EventDispatcher
Known subclasses:
Version:12/23/08
Author:Aaron Clinger
Classpath:org.casalib.process.ProcessGroup
File last modified:Monday, 19 January 2009, 16:22:11
Manages and threads processes.
Example:
  • package {
        import fl.motion.easing.Linear;
        import flash.display.MovieClip;
        import flash.display.Sprite;
        import org.casalib.events.ProcessEvent;
        import org.casalib.process.ProcessGroup;
        import org.casalib.transitions.PropertyTween;
    
    
        public class MyExample extends MovieClip {
            protected var _processGroup:ProcessGroup;
    
    
            public function MyExample() {
                super();
    
                this._processGroup = new ProcessGroup();
                this._processGroup.addEventListener(ProcessEvent.COMPLETE, this._onProcessComplete);
    
                var i:int = -1;
                var box:Sprite;
                while (++i < 10) {
                    box   = new Sprite();
                    box.y = 30 * i;
                    box.graphics.beginFill(0xFF00FF);
                    box.graphics.drawRect(0, 0, 25, 25);
                    box.graphics.endFill();
    
                    this.addChild(box);
    
                    this._processGroup.addProcess(new PropertyTween(box, 'x', Linear.easeNone, 500, 1));
                }
    
                this._processGroup.start();
            }
    
            protected function _onProcessComplete(e:ProcessEvent):void {
                this._processGroup.destroyProcesses();
                this._processGroup.destroy();
    
                trace("Done!");
            }
        }
    }

Summary


Constructor
Class properties
  • NORM_THREADS : int
    • The default amount of threads for all ProcessGroup instances.
Class properties inherited from Process
Instance properties
  • autoStart : Boolean
    • Instructs the ProcessGroup to start automatically with each added uncompleted Process true, or wait for a implicit startfalse.
  • processes : Array
    • The processes that compose the group.
  • threads : uint
    • The number of simultaneous processes to run at once.
Instance methods

Constructor

ProcessGroup

public function ProcessGroup (
)

Creates a new ProcessGroup.

Class properties

NORM_THREADS

public static NORM_THREADS:int = 1
(read,write)

The default amount of threads for all ProcessGroup instances.

Instance properties

autoStart

public autoStart:Boolean
(read,write)

Instructs the ProcessGroup to start automatically with each added uncompleted Process true, or wait for a implicit start false. Defaults to false.

processes

public processes:Array
(read)

The processes that compose the group.

threads

public threads:uint
(read,write)

The number of simultaneous processes to run at once.

Instance methods

addProcess

public function addProcess (
process:Process) : void

Adds a process to be threaded and run by the ProcessGroup.
Parameters:
process:
The process to be added and run by the group.
Usage note:
  • You can add a different instance of ProcessGroup to another ProcessGroup.
Throws:
  • Error if you try add the same Process to itself.

destroy

override public function destroy (
) : void

Overrides:

destroyProcesses

public function destroyProcesses (
) : void

Calls destroy on all processes in the group and removes them from the ProcessGroup.

removeProcess

public function removeProcess (
process:Process) : void

Removes a process from the ProcessGroup.
Parameters:
process:
The process to be removed.

start

override public function start (
) : void

Overrides:

stop

override public function stop (
) : void

Overrides: