Thread

Thread

Manages the execution of a single thread instance.  This class should be managed by the ThreadManager.

__/ REQUIREMENTS \__

ActionScript 3.0 (or later)

__/ IMPORTS \__

nothing

__/ EXTENDS \__

com.bnm.api.CoreObject

__/ IMPLEMENTS \__

com.bnm.api.CoreInterface

__/ NOTICE \__

©opyright 2008 Bay New Media.  All rights, as stipulated in the The MIT License, are reserved.

This ActionScript library is licensed and released under the MIT License (http://www.opensource.org/licenses/mit-license.php).  Please refer to the accompanying text file “license.txt”, which should be distributed with every package and version of this library, for information on usage, distribution, copying, and other important information.

Please visit http://www.baynewmedia.com/ or email con.nosp@m.tact@baynewm.nosp@m.edia.com for information, questions, concerns, or bug reports.

__/ NOTES \__

This class is commented using the NaturalDocs documentation system.  It is intended to be easily read both from the direct source code and from an adaptation that is generated as hyperlinked HTML.  The NaturalDocs specification used in this class’ documentation is version 1.35 though older versions may probably be used safely.  For more information, please visit: http://www.naturaldocs.org/

The BNMAPI is officially available (primary sources) on Source Forge (http://sourceforge.net/projects/bnmapi/), on the Bay New Media site (http;//www.baynewmedia.com/), on the PeaBee project site (http://www.peabee.com/), and through the Bay New Media SVM repository server (visit http://www.baynewmedia.com/ for more information).  Downloads from other sources may not be complete or up-to-date.

If you’re interested in joining the BNMAPI project in any capacity (development, testing, distribution, etc.), please visit us on Source Forge or the Bay New Media web site.

Summary
ThreadManages the execution of a single thread instance.
Variables
_currentIteration_currentIteration (uint): The current iteration counter of the thread.
_enabled_enabled (Boolean): Tracks whether or not the thread is enabled.
_method
_context
_parameters
_iterations
_timeObject
Functions
ThreadConstructor method for the class.
executeExecutes the thread instance, calling the targetted method with the specified parameters, and at the interval supplied.
resetResets the current thread to its starting state.
disableDisables the thread from further execution.
get statusReturns the status of the current Thread instance.
Properties
status

Variables

_currentIteration

private var _currentIteration: uint

Variable

_currentIteration (uint): The current iteration counter of the thread.  When this equals _iterations, the thread is disabled.

_enabled

private var _enabled: Boolean

Variable

_enabled (Boolean): Tracks whether or not the thread is enabled.  This may be reset using the reset method.  Typically this will be controlled by the execute method.

_method

private var _method: Function

_context

private var _context: *

_parameters

private var _parameters: Array

_iterations

private var _iterations: uint

_timeObject

private var _timeObject: TimeObject

Functions

Thread

public function Thread (threadObj: Object)

Constructor method for the class.

Parameters

threadObj (object, optional): An object containing the thread instance properties.

Returns

Thread: A reference to the newly created class instance.

Broadcasts

nothing

Throws

nothing

execute

public function execute():void

Executes the thread instance, calling the targetted method with the specified parameters, and at the interval supplied.

Parameters

none

Returns

nothing

Broadcasts

”Thread.ERROR”

Throws

nothing

reset

public function reset():void

Resets the current thread to its starting state.  If the thread has expired, this will allow it to run again with the specified parameters.

Returns

nothing

Broadcasts

nothing

Throws

nothing

disable

public function disable():void

Disables the thread from further execution.  This can be reset by calling the reset method.

Parameters

none

Returns

nothing

Broadcasts

nothing

Throws

nothing

Bubbles

no

get status

Returns the status of the current Thread instance.  This can be used to check if parameters and other data were properly received by the class instance.

Returns

int: A value representing the class’ status.  0 means everything is okay and the thread is ready to execute.  -1 means that crucial data is missing and the thread cannot execute.  1 means thread has hit its iteration limit and should either be reset or removed.  Broadcasts: nothing

Throws

nothing

Properties

status

public function get status():int
Provides facilities for data checking and conversion for all types of Flash data types.
private var _currentIteration: uint
_currentIteration (uint): The current iteration counter of the thread.
private var _enabled: Boolean
_enabled (Boolean): Tracks whether or not the thread is enabled.
private var _method: Function
private var _context: *
private var _parameters: Array
private var _iterations: uint
private var _timeObject: TimeObject
public function Thread (threadObj: Object)
Constructor method for the class.
public function execute():void
Executes the thread instance, calling the targetted method with the specified parameters, and at the interval supplied.
public function reset():void
Resets the current thread to its starting state.
public function disable():void
Disables the thread from further execution.
public function get status():int