User Guide

180 Chapter 2: ActionScript Language Reference
The user can also specify permanent privacy settings for a particular domain by right-clicking
(Windows) or Control-clicking (Macintosh) while a SWF file is playing, selecting Settings,
opening the Privacy panel, and selecting Remember.
You cant use ActionScript to set the Allow or Deny value for a user, but you can display the
Privacy panel for the user by using
System.showSettings(0). If the user selects Remember,
Flash Player no longer displays the Privacy dialog box for SWF files from this domain.
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 doesnt
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. 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
Camera.index, Camera.muted, Camera.names, Camera.onStatus, Camera.setMode(),
System.showSettings(), Video.attachVideo()