EasyManua.ls Logo

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE - Index (Camera.index Property)

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
1378 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
390 ActionScript classes
Example
The following code displays the current width, height and FPS of a video instance in a Label
component instance on the Stage. 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
dimensions_lbl. 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 dimensions_lbl:mx.controls.Label;
dimensions_lbl.setStyle("fontSize", 9);
dimensions_lbl.setStyle("fontWeight", "bold");
dimensions_lbl.setStyle("textAlign", "center");
dimensions_lbl.text = "width: "+my_cam.width+", height: "+my_cam.height+",
FPS: "+my_cam.fps;
See also the example for Camera.setMode().
See also
width (Camera.width property), setMode (Camera.setMode method)
index (Camera.index property)
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.
Availability: ActionScript 1.0; Flash Player 6
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
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);
camera_lbl.text = my_cam.index+". "+my_cam.name;
this.createTextField("cameras_txt", this.getNextHighestDepth(), 25, 160,
160, 80);

Table of Contents

Related product manuals