Example
The following example detects the amount of motion the camera detects using the
activityLevel
// video instance on the Stage.
var my_video:Video;
var activity_pb:mx.controls.ProgressBar;
var my_cam:Camera = Camera.get();
my_video.attachVideo(my_cam);
activity_pb.mode = "manual";
activity_pb.label = "Activity %3%%";
this.onEnterFrame = function() {
activity_pb.setProgress(my_cam.activityLevel, 100);
};
my_cam.onActivity = function(isActive:Boolean) {
var themeColor:String = (isActive) ? "haloGreen" : "haloOrange";
activity_pb.setStyle("themeColor", themeColor);
};
See also
Camera.motionLevel
Camera.bandwidth
Availability
Flash Player 6.
Usage
active_cam.bandwidth:Number
Description
Read-only property; an integer that specifies the maximum amount of bandwidth the current
outgoing video feed can use, in bytes. A value of 0 means that Flash video can use as much
bandwidth as needed to maintain the desired frame quality.
To set this property, use
Example
The following example changes the maximum amount of bandwidth used by the camera feed.
var bandwidth_nstep:mx.controls.NumericStepper;
var my_video:Video;
var my_cam:Camera = Camera.get();
my_video.attachVideo(my_cam);
this.createTextField("bandwidth_txt", this.getNextHighestDepth(), 0, 0, 100,
22);
bandwidth_txt.autoSize = true;
this.onEnterFrame = function() {
bandwidth_txt.text = "Camera is currently using "+my_cam.bandwidth+" bytes
("+Math.round(my_cam.bandwidth/1024)+" KB) bandwidth.";
};
494
Chapter 7: ActionScript for Flash
property:
,
Camera.setMotionLevel()
Camera.setQuality()
.