Camera.index - MACROMEDIA FLASH MX 2004-ACTIONSCRIPT LANGUAGE Reference

Actionscript language reference
Table of Contents

Advertisement

Camera.index

Availability
Flash Player 6.
Usage
active_cam.index:Number
Description
Read-only property; a zero-based integer that specifies the index of the camera, as reflected in 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
. Add a Label component instance to the Stage and give it the instance name
my_video
. Then add the following ActionScript to Frame 1 of the Timeline:
camera_lbl
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;
}
See also
Camera.get(),
Camera.names
182
Chapter 2: ActionScript Language Reference
.
Camera.names

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004-ACTIONSCRIPT LANGUAGE and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash mx

Table of Contents