Camera.motionTimeOut

Availability

Usage

public motionTimeOut : Number [read-only]

Description

Property (read-only); the number of milliseconds between the time the camera stops detecting motion and the time Camera.onActivity(false) is invoked. The default value is 2000 (2 seconds).

To set this value, use Camera.setMotionLevel().

Example

In the following example, the ProgressBar instance changes its halo theme color when the activity level falls below the motion level. You can set the number of seconds for the motionTimeout property using a NumericStepper instance. Create a new video instance by selecting New Video from the Library options menu. Add an instance to the Stage and give it the instance name my_video. Add a Label component instance to the Stage and give it the instance name motionLevel_lbl, a NumericStepper with the instance name motionTimeOut_nstep, and a ProgressBar with the instance name motion_pb. Then add the following ActionScript to Frame 1 of the Timeline:

var motionLevel_lbl:mx.controls.Label;
var motion_pb:mx.controls.ProgressBar;
var motionTimeOut_nstep:mx.controls.NumericStepper;
var my_cam:Camera = Camera.get();
var my_video:Video;
my_video.attachVideo(my_cam);

this.onEnterFrame = function() {
    motionLevel_lbl.text = "activityLevel: "+my_cam.activityLevel;
};

motion_pb.indeterminate = true;
my_cam.onActivity = function(isActive:Boolean) {
    if (isActive) {
    motion_pb.setStyle("themeColor", "haloGreen");
    motion_pb.label = "Motion is above "+my_cam.motionLevel;
    } else {
    motion_pb.setStyle("themeColor", "haloOrange");
    motion_pb.label = "Motion is below "+my_cam.motionLevel;
    }
};
function changeMotionTimeOut() {
    my_cam.setMotionLevel(my_cam.motionLevel, motionTimeOut_nstep.value/ 1000);
}
motionTimeOut_nstep.addEventListener("change", changeMotionTimeOut);
motionTimeOut_nstep.value = my_cam.motionTimeOut/1000;

See also

Camera.onActivity, Camera.setMotionLevel()


 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/fms/2/docs/00000537.html