Справочник Пользователя для Macromedia flash media server 2-client-side actionscript language reference for flash media server 2
Camera class
19
Usage
active_cam.index
Description
Property (read-only); a zero-based integer that specifies the index of the camera, as reflected in
the array returned by
the array returned by
Example
The following example displays an array of cameras in a text field that is created at runtime,
and tells you which camera you are currently using. 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
and tells you which camera you are currently using. 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
. Then add the following ActionScript to Frame 1 of the Timeline:
var camera_lbl:mx.controls.Label;
var my_cam:Camera = Camera.get();
var my_video:Video;
my_video.attachVideo(my_cam);
var my_cam:Camera = Camera.get();
var my_video:Video;
my_video.attachVideo(my_cam);
camera_lbl.text = my_cam.index+". "+my_cam.name;
this.createTextField("cameras_txt", this.getNextHighestDepth(), 25, 160,
this.createTextField("cameras_txt", this.getNextHighestDepth(), 25, 160,
160, 80);
cameras_txt.html = true;
cameras_txt.border = true;
cameras_txt.wordWrap = true;
cameras_txt.multiline = true;
for (var i = 0; i<Camera.names.length; i++) {
cameras_txt.htmlText += "<li><u><a
cameras_txt.border = true;
cameras_txt.wordWrap = true;
cameras_txt.multiline = true;
for (var i = 0; i<Camera.names.length; i++) {
cameras_txt.htmlText += "<li><u><a
href=\"asfunction:changeCamera,"+i+"\">"+Camera.names[i]+"</a></u></
li>";
li>";
}
function changeCamera(index:Number) {
my_cam = Camera.get(index);
my_video.attachVideo(my_cam);
camera_lbl.text = my_cam.index+". "+my_cam.name;
}
function changeCamera(index:Number) {
my_cam = Camera.get(index);
my_video.attachVideo(my_cam);
camera_lbl.text = my_cam.index+". "+my_cam.name;
}
The
MovieClip.getNextHighestDepth()
method used in this example requires Flash Player
7 or later. If your SWF file includes a v2 component (version 2 of the Macromedia
Component Architecture), use the DepthManager class from the component framework
instead of the
Component Architecture), use the DepthManager class from the component framework
instead of the
MovieClip.getNextHighestDepth()
method.
See also