Displaying a webcam’s video in a Flex VideoDisplay control

The following example shows you how you can display a user’s webcam feed in a VideoDisplay control using the static Camera.getCamera() method and VideoDisplay class’s attachCamera() method.

Full code after the jump.

<?xml version=”1.0″ encoding=”utf-8″?>
<!– http://blog.flexexamples.com/2008/01/22/displaying-a-webcams-video-in-a-flex-videodisplay-control/ –>
<mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml&#8221;

import mx.controls.Alert;

private function videoDisplay_creationComplete():void {
var camera:Camera = Camera.getCamera();
if (camera) {
} else {
Alert.show(“You don’t seem to have a camera.”);

<mx:VideoDisplay id=”videoDisplay”
height=”120″ />

<mx:Button id=”button”
label=”Reload Camera”
click=”videoDisplay_creationComplete();” />


~ by mjcprasad2000 on April 11, 2009.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: