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 undo 23 Aug 2011
    Embed
package
{
    
    import flash.display.*;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.geom.Matrix;

    [SWF(width=465,height=465,backgroundColor=0x000000,frameRate=60)]
    public class ASTest extends Sprite
    {
        
        private var _bmp:Bitmap;
        private var _bmd:BitmapData;
        
        private var _vector:Vector.<BitmapData>;
        private var _index:int = 0;
        
        private const AMPLITUDE:Number = 50;
        
        public function ASTest()
        {
            this.addEventListener(Event.ADDED_TO_STAGE, init);
        }
        private function init(evt:Event = null):void
        {
            _bmd = new BitmapData(stage.stageWidth,stage.stageHeight, false, 0xff0000);
            _bmp = new Bitmap(_bmd);
            addChild(_bmp);
            
            makeColor();
            addEventListener(Event.ENTER_FRAME, onEnter)
            stage.addEventListener(MouseEvent.CLICK, onClick);
        }
        private function makeColor():void
        {
            _vector = new Vector.<BitmapData>();
            var c1:uint = Math.random()*0xffffff;
            var c2:uint = Math.random()*0xffffff;
            var src:Sprite = new Sprite();
            var matrix:Matrix = new Matrix();
            matrix.createGradientBox(AMPLITUDE,AMPLITUDE,0,stage.stageWidth/2 - AMPLITUDE/2, stage.stageHeight/2 - AMPLITUDE/2);
            var bmd:BitmapData;
            for(var i:int = 0; i < 5; i++)
            {
                bmd = new BitmapData(stage.stageWidth, stage.stageHeight, false, 0x0);
                src.graphics.clear();
                src.graphics.beginGradientFill(GradientType.RADIAL, [c2,c1,c1],[1,1,1],[0,255*i/5,255],matrix,SpreadMethod.REPEAT);
                src.graphics.drawRect(0,0,stage.stageWidth,stage.stageHeight);
                src.graphics.endFill();
                bmd.draw(src);
                _vector.push(bmd);
            }
            for(i = 0; i < 5; i++)
            {
                bmd = new BitmapData(stage.stageWidth, stage.stageHeight, false, 0x0);
                src.graphics.clear();
                src.graphics.beginGradientFill(GradientType.RADIAL, [c1,c2,c1],[1,1,1],[0,255*i/5,255],matrix,SpreadMethod.REPEAT);
                src.graphics.drawRect(0,0,stage.stageWidth,stage.stageHeight);
                src.graphics.endFill();
                bmd.draw(src);
                _vector.push(bmd);
            }
            for(i = 0; i < 5; i++)
            {
                bmd = new BitmapData(stage.stageWidth, stage.stageHeight, false, 0x0);
                src.graphics.clear();
                src.graphics.beginGradientFill(GradientType.RADIAL, [c1,c1,c2],[1,1,1],[0,255*i/5,255],matrix,SpreadMethod.REPEAT);
                src.graphics.drawRect(0,0,stage.stageWidth,stage.stageHeight);
                src.graphics.endFill();
                bmd.draw(src);
                _vector.push(bmd);
            }
        }
        private function onEnter(evt:Event):void
        {
            _bmd.lock();
            if(_index >= _vector.length) _index = 0;
            _bmd = _vector[_index].clone();
            _bmp.bitmapData = _bmd;
            _bmd.unlock();
            _index ++;
        }
        private function onClick(evt:MouseEvent):void
        {
            makeColor();
        }
    }
}