Home > Actionscript 3, Flash > Tutorial Actionscript 3 – How to use a webcam on Flash

Tutorial Actionscript 3 – How to use a webcam on Flash

Use the webcam in flash is very easy. You need a Video instance and Camera instance.

1
2
3
4
5
6
7
8
9
10
//Create a video instance
video = new Video(640, 480);
//Get the camera reference.
camara = Camera.getCamera();
//setMode need 3 params, width, height and frame rate.
//Optianally you can set a boolean value at the end for the 	favorArea.
camara.setMode(640, 480, 30);
//put the camera in the video instance
video.attachCamera(camara);
addChild(video);

VIEW EXAMPLE
DOWNLOAD EXAMPLE


Categories: Actionscript 3, Flash Tags:
  1. Rodolfo Lopez Navarrate
    August 26th, 2009 at 13:36 | #1

    genial bien

  2. January 14th, 2010 at 13:06 | #2

    Don’t forget to correctly define the camera and video variable types:
    var video:Video = new Video(640, 480);
    var camara:Camera = Camera.getCamera();

  3. ani
    February 15th, 2010 at 03:52 | #3

    Very nice article…

  4. Carlos
    February 24th, 2010 at 14:21 | #4

    Hi Can you help me ? i use this to turn on webcam but how i can show my webcam image to other people ?

    I hope u can help me.

  5. February 24th, 2010 at 15:01 | #5

    John: Sure, if you download the example you will see, the type of the vars are defined. In the post is only an example of how to use it. Have not the definition var too.

    Carlos: To do that, you have to stream your webcam. This must be done using a server like Flash Media Server or RED5. Look for streaming in google you will found a lot of info.

Spam Protection by WP-SpamFree

Get Adobe Flash playerPlugin by wpburn.com wordpress themes