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 nucode 22 Dec 2008
    Embed
package  {
    import flash.display.*;
    import flash.events.*;
    import flash.media.Camera;
    import flash.media.Video;
    import flash.geom.*;
    import flash.system.*;

    public class multiPanel extends Sprite {
        private const GRID_X:int = 4;
        private const GRID_Y:int = 4;
        private const VIDEO_W:int = 320;
        private const VIDEO_H:int = 240;
        private const TOTAL_FRAME:int = GRID_X * GRID_Y;
        private var video:Video = new Video(VIDEO_W*2,VIDEO_H*2);
        private var recBmd:Array = new Array(TOTAL_FRAME);
        private var drawBmp:Array = new Array(TOTAL_FRAME);
        private var drawPos:Array = new Array(TOTAL_FRAME);
        private var currentFrame:int = 0;

        public function multiPanel() {
            Security.showSettings(SecurityPanel.CAMERA);
            var camera:Camera = Camera.getCamera();
            if(camera != null){
                camera.setMode(160*2, 120*2, 10);
                video.attachCamera(camera);
                for(var i:int = 0;i < recBmd.length;i++){
                    recBmd[i]  = new BitmapData(VIDEO_W*2, VIDEO_H*2, false, 0);
                    drawBmp[i] = new Bitmap(recBmd[i]);
                }
                for(var y:int = 0;y < GRID_Y;y++){
                    for(var x:int = 0;x < GRID_X;x++){
                        var frame:int = y * GRID_X + x;
                        drawPos[frame] = new Point(72,72);
                        drawBmp[frame].x = drawPos[frame].x; 
                        drawBmp[frame].y = drawPos[frame].y; 
                        drawBmp[frame].alpha = 0.1;
                        drawBmp[frame].scaleX = 0.5;
                        drawBmp[frame].scaleY = 0.5;
                        if((y ==0 )&&(x ==0))drawBmp[frame].alpha = 1.0;
                        addChild(drawBmp[frame]);
                    }
                }
                this.addEventListener(Event.ENTER_FRAME, onEnterFrame);
            }
        }

        private function onEnterFrame(evt:Event) :void { 
            var drawFrame:int = currentFrame;
            recBmd[currentFrame].draw(video);
            for(var i:int = 0;i < TOTAL_FRAME;i++){
                drawBmp[i].x = drawPos[drawFrame].x; 
                drawBmp[i].y = drawPos[drawFrame].y; 
                drawFrame--;
                if(drawFrame < 0)drawFrame = TOTAL_FRAME - 1;
            }
            currentFrame++;
            if(currentFrame > TOTAL_FRAME - 1)currentFrame = 0;
        }
    }
}