Initializing Camera (AS3)

This is how you get the camera using ActionScript 3.0, very useful for your Webcam/FMS related projects

[code]
package {

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

public class createCamera extends Video {

private var camera:Camera;
private var camQ:int = 0;
private var FPS:int = 30;

public function createCamera (w:Number = 320, h:Number = 240)
{
this.width = w;
this.height = h;
startCamera();
}

public function startCamera():void
{
camera = Camera.getCamera();
camera.setQuality(0, camQ);
camera.setMode(this.width, this.height, FPS);
this.attachCamera(camera);
}
}
}
[/code]

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>