In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

どっとかめら

Get Adobe Flash player
by minon 17 Jan 2009
// forked from minon's webcam
package {
	
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.media.Camera;
	import flash.media.Video;
	
	public class Main extends Sprite {
		
		private var _view :Sprite;
		
		private var _cam:Camera;
		private var _video:Video;
		
		private var _canvas:Sprite = new Sprite();
		
		public function Main():void {
			
			init();
			
		}
		
		private function init():void {
			
			_view = new Sprite();
			this.addChild( _view );
			
			_cam = Camera.getCamera();
			_cam.setMode( 500, 500, 15 );
			
			_video = new Video( 500 , 500 );
			_video.attachCamera( _cam );
			
			this.addChild( _canvas );
			
			this.addEventListener( Event.ENTER_FRAME, _update );
			
		}
		
		private function _update(e:Event):void {
			
			var unit:int = 15;
			var base:BitmapData = new BitmapData( 465, 465 );
			base.draw( _video );
			
			_canvas.graphics.clear();
			
			for (var i:int = 0; i < 465 / unit ; i++) {
				
				for (var j:int = 0; j < 465 / unit ; j++) {
					
					var col:int = base.getPixel( i*unit + 5, j*unit + 5 );
					_canvas.graphics.beginFill( col )
					_canvas.graphics.drawCircle(i*unit, j*unit, unit/2*0.8 );
					_canvas.graphics.endFill();
					
				}
				
			}
			
		}
		
		
		
		
	}
}