Client-Side Communication ActionScript > Camera.onActivity

 

Camera.onActivity

Availability

Flash Player 6.

Flash Communication Server MX (not required).

Usage

activeCamera.onActivity = function(activity) {
	// Your code here
}

Parameters

activity A Boolean value set to true when the camera starts detecting motion, false when it stops.

Returns

Nothing.

Description

Event handler; invoked when the camera starts or stops detecting motion. If you want to respond to this event handler, you must create a function to process its activity value.

To specify the amount of motion required to invoke Camera.onActivity(true) and the amount of time that must elapse without activity before invoking Camera.onActivity(false), use Camera.setMotionLevel.

Example

The following example displays true or false in the Output window when the camera starts or stops detecting motion.

// Assumes a Video object named "myVideoObject" is on the Stage
c = Camera.get();
myVideoObject.attachVideo(c);
c.setMotionLevel(10, 500);
c.onActivity = function(mode)
{
	trace(mode);
};

See also

Camera.setMotionLevel