
504
Chapter 7: ActionScript for Flash
Example
The following example uses the default camera unless more than one camera is available, in which
case the user can choose which camera to set as the default camera. If only one camera is present,
then the default camera is used.
var my_video:Video;
var cam_array:Array = Camera.names;
if (cam_array.length>1) {
System.showSettings(3);
}
var my_cam:Camera = Camera.get();
my_video.attachVideo(my_cam);
See also
Camera.get()
,
Camera.index
,
Camera.name
Camera.onActivity
Availability
Flash Player 6.
Usage
active_cam
.onActivity = function(
activity:Boolean
)
: Void
{
// your statements 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 writes to the log file when the camera starts or stops detecting motion:
// Assumes a Video object named "myVideoObject" is on the Stage
active_cam = Camera.get();
myVideoObject.attachVideo(active_cam);
active_cam.setMotionLevel(10, 500);
active_cam.onActivity = function(mode)
{
Содержание FLEX-FLEX ACTIONSCRIPT LANGUAGE
Страница 1: ...Flex ActionScript Language Reference...
Страница 8: ......
Страница 66: ...66 Chapter 2 Creating Custom Classes with ActionScript 2 0...
Страница 76: ......
Страница 133: ...break 133 See also for for in do while while switch case continue throw try catch finally...
Страница 135: ...case 135 See also break default strict equality switch...
Страница 146: ...146 Chapter 5 ActionScript Core Language Elements See also break continue while...
Страница 229: ...while 229 i 3 The following result is written to the log file 0 3 6 9 12 15 18 See also do while continue for for in...
Страница 808: ...808 Chapter 7 ActionScript for Flash...
Страница 810: ...810 Appendix A Deprecated Flash 4 operators...
Страница 815: ...Other keys 815 Num Lock 144 186 187 _ 189 191 192 219 220 221 222 Key Key code...
Страница 816: ...816 Appendix B Keyboard Keys and Key Code Values...
Страница 822: ...822 Index...