498
Chapter 7: ActionScript for Flash
If
Camera.get
returns
null
, either the camera is in use by another application, or there are no
cameras installed on the system. To determine whether any cameras are installed, use
Camera.names.length
. To display the Flash Player Camera Settings panel, which lets the user
choose the camera to be referenced by
Camera.get()
, use
System.showSettings(3)
.
Scanning the hardware for cameras takes time. When Flash finds at least one camera, the
hardware is not scanned again for the lifetime of the player instance. However, if Flash doesn’t
find any cameras, it will scan each time
Camera.get
is called. This is helpful if a user has
forgotten to connect the camera; if your SWF file provides a Try Again button that calls
Camera.get
, Flash can find the camera without the user having to restart the SWF file.
Example
The following example lets you select an active camera to use from a ComboBox instance. The
current active camera is displayed in a Label instance.
var my_cam:Camera = Camera.get();
var my_video:Video;
my_video.attachVideo(my_cam);
var camera_lbl:mx.controls.Label;
var cameras_cb:mx.controls.ComboBox;
camera_lbl.text = my_cam.name;
cameras_cb.dataProvider = Camera.names;
function changeCamera():Void {
my_cam = Camera.get(cameras_cb.selectedIndex);
my_video.attachVideo(my_cam);
camera_lbl.text = my_cam.name;
}
cameras_cb.addEventListener("change", changeCamera);
camera_lbl.setStyle("fontSize", 9);
cameras_cb.setStyle("fontSize", 9);
See also
Camera.index
,
Camera.muted
,
Camera.names
,
Camera.onStatus
,
Camera.setMode()
,
System.showSettings()
,
Video.attachVideo()
Camera.height
Availability
Flash Player 6.
Usage
active_cam
.height
:Number
Description
Read-only property; the current capture height, in pixels. To set a value for this property, use
Camera.setMode()
.
Example
The following code displays the current width, height and FPS of a video instance in a Label
component instance on the Stage.
Summary of Contents for FLEX-FLEX ACTIONSCRIPT LANGUAGE
Page 1: ...Flex ActionScript Language Reference...
Page 8: ......
Page 66: ...66 Chapter 2 Creating Custom Classes with ActionScript 2 0...
Page 76: ......
Page 133: ...break 133 See also for for in do while while switch case continue throw try catch finally...
Page 135: ...case 135 See also break default strict equality switch...
Page 146: ...146 Chapter 5 ActionScript Core Language Elements See also break continue while...
Page 808: ...808 Chapter 7 ActionScript for Flash...
Page 810: ...810 Appendix A Deprecated Flash 4 operators...
Page 815: ...Other keys 815 Num Lock 144 186 187 _ 189 191 192 219 220 221 222 Key Key code...
Page 816: ...816 Appendix B Keyboard Keys and Key Code Values...
Page 822: ...822 Index...