03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

var my_cam:Camera = Camera.get();<br />

var my_video:Video;<br />

my_video.attachVideo(my_cam);<br />

var camera_lbl:mx.controls.Label;<br />

var cameras_cb:mx.controls.ComboBox;<br />

camera_lbl.text = my_cam.name;<br />

cameras_cb.dataProvider = Camera.names;<br />

function changeCamera():Void {<br />

my_cam = Camera.get(cameras_cb.selectedIndex);<br />

my_video.attachVideo(my_cam);<br />

camera_lbl.text = my_cam.name;<br />

}<br />

cameras_cb.addEventListener("change", changeCamera);<br />

camera_lbl.setStyle("fontSize", 9);<br />

cameras_cb.setStyle("fontSize", 9);<br />

See also<br />

index (Camera.index property), muted (Camera.muted property), names<br />

(Camera.names property), onStatus (Camera.onStatus h<strong>and</strong>ler), setMode<br />

(Camera.setMode method), showSettings (System.showSettings method),<br />

attachVideo (Video.attachVideo method)<br />

height (Camera.height property)<br />

public height : Number [read-only]<br />

The current capture height, in pixels. To set a value for this property, use Camera.setMode().<br />

Availability: <strong>ActionScript</strong> 1.0; Flash Player 6<br />

Example<br />

The following code displays the current width, height <strong>and</strong> FPS of a video instance in a Label<br />

component instance on the Stage. Create a new video instance by selecting New Video from<br />

the Library options menu. Add an instance to the Stage <strong>and</strong> give it the instance name<br />

my_video. Add a Label component instance to the Stage <strong>and</strong> give it the instance name<br />

dimensions_lbl. Then add the following <strong>ActionScript</strong> to Frame 1 of the Timeline:<br />

var my_cam:Camera = Camera.get();<br />

var my_video:Video;<br />

my_video.attachVideo(my_cam);<br />

var dimensions_lbl:mx.controls.Label;<br />

dimensions_lbl.setStyle("fontSize", 9);<br />

dimensions_lbl.setStyle("fontWeight", "bold");<br />

dimensions_lbl.setStyle("textAlign", "center");<br />

dimensions_lbl.text = "width: "+my_cam.width+", height: "+my_cam.height+",<br />

FPS: "+my_cam.fps;<br />

396 <strong>ActionScript</strong> classes

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!