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
. Add a Label component instance to the Stage and give it the instance name
my_video
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
See also
width (Camera.width property)
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
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);
390
ActionScript classes
.
Camera.setMode()
,
setMode (Camera.setMode method)
. Add a Label component instance to the Stage and give it the
Need help?
Do you have a question about the FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE and is the answer not in the manual?
Questions and answers