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 knd 04 Nov 2010
package 
{
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.display.BitmapDataChannel;
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.filters.ColorMatrixFilter;
    import flash.geom.ColorTransform;
    import flash.geom.Point;
    import flash.media.Camera;
    import flash.media.Video;
    import flash.utils.getTimer;
    
    /**
     * ...
     * @author @kndys
     */
    public class Main extends Sprite 
    {
        private static const _W:Number = 232;
        private static const _H:Number = 232;
        private static const _PT0:Point = new Point();
        
        private var _camera:Camera;
        private var _video:Video;
        private var _noise:BitmapData;
        private var _videoImage:BitmapData;
        private var _canvas:BitmapData;
        
        public function Main():void 
        {
            if (stage) init();
            else addEventListener(Event.ADDED_TO_STAGE, init);
        }
        
        private function init(e:Event = null):void 
        {
            removeEventListener(Event.ADDED_TO_STAGE, init);
            // entry point
            _camera = Camera.getCamera();
            _camera.setMode(_W, _H, 30);
            _video = new Video(_W, _H);
            _video.attachCamera(_camera);
            
            _noise = new BitmapData(_W, _H, true, 0);
            _videoImage = new BitmapData(_W, _H, true, 0);
            _canvas = new BitmapData(_W, _H, true, 0);
            
            scaleX = scaleY = 2.0;
            addChild(new Bitmap(_canvas));
            addEventListener(Event.ENTER_FRAME, loop);
        }
        
        private function loop(e:Event):void 
        {
            _noise.noise(getTimer(), 0x0, 0x66, BitmapDataChannel.ALPHA, false);
            _videoImage.draw(_video);
            _videoImage.copyChannel(_noise, _noise.rect, _PT0, BitmapDataChannel.ALPHA, BitmapDataChannel.ALPHA);
            _canvas.draw(_videoImage);
        }
        
    }
    
}