Camera
389
Returns
Camera
- If
index
is not specified, this method returns a reference to the default camera or, if
it is in use by another application, to the first available camera. (If there is more than one
camera installed, the user may specify the default camera in the Flash Player Camera Settings
panel.) If no cameras are available or installed, the method returns
null
. If
index
is specified,
this method returns a reference to the requested camera, or
null
if it is not available.
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. 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 camera_lbl, and a ComboBox component instance and give it the instance
name
cameras_cb
. Then add the following ActionScript to Frame 1 of the Timeline:
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
index (Camera.index property)
,
muted (Camera.muted property)
,
names
(Camera.names property)
,
onStatus (Camera.onStatus handler)
,
setMode
(Camera.setMode method)
,
showSettings (System.showSettings method)
,
attachVideo (Video.attachVideo method)
height (Camera.height property)
public height : Number [read-only]
The current capture height, in pixels. To set a value for this property, use
Camera.setMode()
.
Availability:
ActionScript 1.0; Flash Player 6
Summary of Contents for FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
Page 1: ...ActionScript 2 0 Language Reference ...
Page 1352: ...1352 ActionScript classes ...