code on 2008-12-18
package
{
import flash.events.Event;
import flash.display.Sprite;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.geom.Matrix;
import flash.media.Video;
import flash.media.Camera;
[SWF(frameRate="30", backgroundColor="#64FD24")]
public class Main extends Sprite
{
public function Main()
{
var camera:Camera = Camera.getCamera();
if(camera)
{
var video:Video = new Video(400, 400 / camera.width * camera.height);
video.attachCamera(camera);
var image:BitmapData = new BitmapData(video.width, video.height, false);
var bitmap:Bitmap = new Bitmap(image);
bitmap.x = -video.width / 2;
bitmap.y = -video.height / 2;
addChild(bitmap);
this.x = this.y = 465 / 2;
addEventListener("enterFrame", function(event:Event):void
{
image.draw(video, new Matrix(-1, 0, 0, 1, video.width, 0));
rotationY = mouseX * 0.1;
rotationX = -mouseY * 0.1;
});
}
}
}
}