Wednesday, October 6, 2010

Activate A Webcam with Actionscript

Flex Builder 4 Flash Video Flash Video Flash Video


Activate A Webcam with Actionscript

Webcams can serve as a source of video data that you can use with ActionScript. The Camera class is built into ActionScript allowing you to build applications that include webcams.

Ways to get the camera to work

  1. Inside the library panel menu, select New Video
  2. Drag an instance of the video to the stage
  3. Size the video
  4. Give the empty video shell the instance name of myCam
  5. Copy and paste the code below
  6. Test the movie and activate the camera.

The Code

import flash.media.Camera;
import flash.media.Video;

var camera:Camera = Camera.getCamera();

if (camera != null) {

myCam.attachCamera(camera);

} else {
trace("You need a camera.");

}

stop();


ActionScript 3.0 Reference

Camera — final class, package flash.media
Use the Camera class to capture video from the client system's camera.

CAMERA
— Constant Static Property, class flash.system.SecurityPanelWhen passed to Security.showSettings(), displays the Camera panel in Flash Player Settings.

CameraRoll — class, package flash.mediaThe CameraRoll class allows you to save image data to a system's "camera roll." AIR profile support: This feature is supported on mobile devices, but it is not supported on desktop operating systems.

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...