package {
import flash.display.Sprite;
import flash.display.MovieClip;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.*;
import flash.media.Camera;
import flash.media.Video;
public class CameraExample extends Sprite {
private var video:Video;
public function CameraExample() {
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
var camera:Camera= Camera.getCamera();
if (camera!= null) {
camera.addEventListener(ActivityEvent.ACTIVITY, activityHandler);
video = new Video(camera.width * 2, camera.height * 2);
video.attachCamera(camera)
addChild(video);
} else {
trace("You need a Camera.");
}
}
private function activityHandler(event:ActivityEvent):void {
trace("activityHandler: " + event);
}
}
}
我的网站设计 web design home page
http://www.webdesign-cn.com
http://www.webdesign-china.cn