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_video:Video;<br />

var fps_pb:mx.controls.ProgressBar;<br />

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

my_video.attachVideo(my_cam);<br />

this.onEnterFrame = function() {<br />

fps_pb.setProgress(my_cam.fps-my_cam.currentFps, my_cam.fps);<br />

};<br />

fps_pb.setStyle("fontSize", 10);<br />

fps_pb.setStyle("themeColor", "haloOrange");<br />

fps_pb.labelPlacement = "top";<br />

fps_pb.mode = "manual";<br />

fps_pb.label = "FPS: %2 (%3%% dropped)";<br />

See also<br />

setMode (Camera.setMode method), fps (Camera.fps property)<br />

fps (Camera.fps property)<br />

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

The maximum rate at which you want the camera to capture data, in frames per second. The<br />

maximum rate possible depends on the capabilities of the camera; that is, if the camera<br />

doesn't support the value you set here, this frame rate will not be achieved.<br />

■ To set a desired value for this property, use Camera.setMode().<br />

■ To determine the rate at which the camera is currently capturing data, use the<br />

Camera.currentFps property.<br />

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

Example<br />

The following example detects the rate in frames per second that the camera captures data,<br />

using the currentFps property <strong>and</strong> a ProgressBar instance. Create a new video instance by<br />

selecting New Video from the Library options menu. Add an instance to the Stage <strong>and</strong> give it<br />

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

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

var my_video:Video;<br />

var fps_pb:mx.controls.ProgressBar;<br />

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

my_video.attachVideo(my_cam);<br />

this.onEnterFrame = function() {<br />

fps_pb.setProgress(my_cam.fps-my_cam.currentFps, my_cam.fps);<br />

};<br />

Camera 393

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

Saved successfully!

Ooh no, something went wrong!