public index : Number[read-only]
A zero-based integer that specifies the index of the camera, as reflected in the array returned by Camera.names.
Flash Media Server (not required); Flash Player 6.
The following example displays an array of cameras in a text field that is created at run time and tells you which camera you are currently using. Create a new video instance by selecting New Video from the Library panel 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 code 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);
camera_lbl.text = my_cam.index+". "+my_cam.name;
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 href=\"asfunction:changeCamera,"+i+"\">"+Camera.names[i]+"</a></u></li>";
}
function changeCamera(index:Number) {
my_cam = Camera.get(index);
my_video.attachVideo(my_cam);
camera_lbl.text = my_cam.index+". "+my_cam.name;
}