setInterval()

Availability:

SmartFoxServer PRO 1.2.1 / 1.3.0

Usage:

setInterval(functionName, interval)
setInterval(functionName, interval, params) (from version 1.3.0)

Description:

Starts a new thread / interval, just like in the Flash API.

Parameters:

functionName     - The name of a valid function that should be executed at the given rate
interval   - The amount of time (expressed in milliseconds) between function calls.
params   - An actionscript object containing any number of properties

Returns:

a reference to the interval

Example:


// This function will be called by the setInterval
function simpleThread(params)
{
	params.countDown--
	
	trace("Countdown: " + params.countDown)
	
	if (params.countDown < 0)
	{
		trace("Shutting down interval")
		clearInterval(myInterval)
	}
}

var params = {}
params.countDown = 100

// Call simpleThread() every 1 second
myInterval = setInterval("simpleThread", 1000, params)

See also:

clearInterval()