Camera class
23
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()
Содержание FLASH MEDIA SERVER 2-CLIENT-SIDE ACTIONSCRIPT LANGUAGE REFERENCE FOR FLASH MEDIA SERVER...
Страница 1: ...Client Side ActionScript Language Reference for Flash Media Server 2...
Страница 4: ...4 Contents...
Страница 148: ...148 Client Side ActionScript Language Reference...