Macromedia flash media server 2-client-side actionscript language reference for flash media server 2 ユーザーズマニュアル

ページ / 156
Camera class
27
Camera.onActivity
Availability
Flash Player 6.
Flash Media Server (not required).
Usage
public onActivity = function(activity:Boolean) {}
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 
.
Example
The following example displays 
true
 or 
false
 in the Output panel when the camera starts or 
stops detecting motion:
// assumes a Video object named "my_video" is on the Stage
var active_cam:Camera = Camera.get();
my_video.attachVideo(active_cam);
active_cam.setMotionLevel(10, 500);
active_cam.onActivity = function(mode) {
trace(mode);
}
See also