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

flash on 2011-5-30

Get Adobe Flash player
by yama3 30 May 2011
    Embed
/**
 * Copyright yama3 ( http://wonderfl.net/user/yama3 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/ntvc
 */

package {
    import flash.text.TextField;
    import flash.display.Bitmap;
    import flash.geom.Rectangle;
    import flash.display.BitmapData;
    import flash.events.Event;
    import flash.display.Graphics;
    import flash.display.Sprite;
    
    public class FlashTest extends Sprite {
        private var _y:Number = 0;
        private var nStartY:Number = 0;
        private var nStopY:Number = 0;
        private var nSign:int = 1;
        
        public function FlashTest() {
            var mySprite:Sprite = new Sprite();
            var myG:Graphics = mySprite.graphics;
            for(var i:uint=0; i<1500; i++) {
                myG.beginFill(Math.random() * 0xffffff);
                myG.drawCircle(Math.random() * 200, Math.random() * 200, Math.random() * 5);
                myG.endFill();
            }
            
            var bd01:BitmapData = new BitmapData(mySprite.width, mySprite.height, true, 0x00000000);
            bd01.draw(mySprite);
            
            var bd02:BitmapData = new BitmapData(mySprite.width, mySprite.height, true, 0x00000000);
            var bm02:Bitmap = new Bitmap(bd02);
            addChild(bm02);
            
            var myText:TextField = new TextField();
            addChild(myText);
            addEventListener(Event.ENTER_FRAME, xFrame);
            
            function xFrame(e:Event):void {
                if(_y >= mySprite.height) {
                    _y = 0;
                    nSign *= -1;
                }
                if(nSign == 1) {
                    nStartY = _y;
                    nStopY = mySprite.height;
                } else {
                    nStartY = 0;
                    nStopY = _y;
                }
                
                _y++;
                
                var rc:Rectangle = new Rectangle(0, _y, mySprite.width, 1);
                for(var i:uint=0; i<mySprite.width; i++) {
                    for(var j:uint = nStartY; j < nStopY; j++) {
                        bd02.setPixel32(i, j, bd01.getPixel32(i, _y))
                    }
                }
            }            
        }
    }
}