Server-Side Communication ActionScript > clearInterval

 

clearInterval

Availability

Flash Communication Server MX.

Usage

clearInterval(intervalID)

Parameters

intervalID A unique ID returned by a previous call to the setInterval method.

Returns

Nothing.

Description

Method (global); cancels a time-out that was set with a call to the setInterval method.

Example

The following example creates a function named callback and passes it to the setInterval method, which is called every 1000 milliseconds and sends the message "interval called" to the Output window. The setInterval method returns a unique identifier that is assigned to the variable intervalID. The identifier allows you to cancel a specific setInterval call. In the last line of code, the intervalID variable is passed to the clearInterval method to cancel the setInterval call:

function callback(){trace("interval called"); 
}
var intervalID; 
intervalID = setInterval(callback, 1000); 
// sometime later 
clearInterval(intervalID);