Showcase and discover digital art at yex

Follow Design Stacks

Subscribe to our free newsletter to get all our latest tutorials and articles delivered directly to your inbox!

Capturing Webcam Video

Capturing Webcam Video

Since the release of Flash Player, you can capture the video stream from a webcam and display it inside a Flash Movie. All you need to do to accomplish this feat is place a Video symbol on the Stage and write a little ActionScript. It sounds complicated, but it is actually quite simple, follow these steps to try it for yourself:

  1. Open the Library (press Control + L).
  2. Create a new Video symbol from the Library menu in the top right-hand corner.
  3. In the Video Properties dialog box, verify that the Video (ActionScript-Controlled) option is selected and click the OK button.
  4. Go to the main Timeline and select the first frame.
  5. Drag the Video symbol from the Library onto the Stage.
  6. Select the Video symbol on the Stage then open the Property inspector (Control + F3).
  7. Enter a unique name in the Instance Name field so you can talk to the video object with ActionScript. For now, enter output_vid for the instance name.
  8. Open the Actions panel on the first frame of the main Timeline (F9) and add the following code:
    /*
    capture the video stream from the active webcam
    and display it inside the video object
    */

    output_vid.attachVideo(Camera.get());
  9. That’s it! Test your movie (press Control + Enter).
  10. Flash Player asks the viewer for permission to access the webcam.
  11. If permission is granted, the Video object you put on the Stage will display the video stream from the webcam.

Comments