
14
When a movie tries to access the camera returned by Camera.get—for example, when you issue
NetStream.attachVideo or Video.attachVideo—the Flash Player displays a Privacy dialog
box that lets the user choose whether to allow or deny access to the camera. (Make sure your
Stage size is at least 215 by 138 pixels; this is the minimum size Flash requires to display the
dialog box.)
When the user responds to this dialog box, the
Camera.onStatus event handler returns an
information object that indicates the user’s response. To determine whether the user has denied or
allowed access to the camera without processing this event handler, use
Camera.muted.
The user can also specify permanent privacy settings for a particular domain by right-clicking
(Windows) or Control-clicking (Macintosh) while a movie is playing, choosing Settings, opening
the Privacy panel, and selecting Remember.
You can’t 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, the
Flash Player no longer displays the Privacy dialog box for movies 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).
Note that scanning the hardware for cameras takes time. Once 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 movie provides a Try Again button that calls
Camera.get, Flash can find the camera without the user having to restart the movie.
Komentáře k této Příručce