Camera.names

Availability

Usage

public static names : Array  [read-only]

NOTE

 

The correct syntax is Camera.names. To assign the return value to a variable, use syntax like var cam_array:Array = Camera.names. To determine the name of the current camera, use active_cam.name, where active_cam is the variable to which you assigned the results of Camera.get().

Description

Class property (read-only); retrieves an array of strings reflecting the names of all available video capture devices (including video capture cards and cameras) without displaying the Flash Player Privacy dialog box. This array behaves the same as any other ActionScript array, implicitly providing the zero-based index of each camera driver and the number of camera drivers on the system (by means of Camera.names.length). For more information, see the Array class entry in the ActionScript 2.0 Language Reference.

Calling the Camera.names property requires an extensive examination of the hardware, and it may take several seconds to build the array. In most cases, you can just use the default camera.

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, the default camera is used.

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. Then add the following ActionScript to Frame 1 of the Timeline:

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.names


 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/fms/2/docs/00000540.html