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

forked from: flash_snow_001

// forked from akirasada1972's flash_snow_001
package {
    import flash.events.Event;
    import flash.display.Graphics;
    import flash.display.Sprite;
    import flash.display.Bitmap
    import flash.display.BitmapData
    import flash.text.TextFormat;
    import flash.text.TextField;
    
    [SWF(FrameRate="7",backgroundColor="0x000000")]
    
    public class flash_snow_001 extends Sprite {

        private const NUM_STAR:int = 100
        private const NUM_SNOW:int = 200
        private var _bd:BitmapData, _bmp:Bitmap
                
        public function flash_snow_001() {
            
            var text:TextField=new TextField();
            var format:TextFormat=new TextFormat();
            showText();
            
            text.visible = false
            _bd = new BitmapData(465, 465, true, 0x0)
            _bd.draw(text, text.transform.matrix, text.transform.colorTransform)
            addChild(_bmp = new Bitmap(_bd))
    
            var _sprite:Array=new Array();

            var sprite_background:Sprite=new Sprite();
            var g_background:Graphics=sprite_background.graphics;
            g_background.beginFill(0x000000);
            g_background.drawRect(0,0,stage.stageWidth,stage.stageHeight);
            stage.addChildAt(sprite_background,0);
            
            for(var i:uint=0;i<NUM_STAR;i++){
                var sprite_back:Sprite=new Sprite();
                var g_back:Graphics=sprite_back.graphics;
                g_back.beginFill(0xffffff);
                g_back.drawCircle(0,0,1);
                stage.addChild(sprite_back)
                sprite_back.x=Math.random()*stage.stageWidth;
                sprite_back.y=Math.random()*stage.stageHeight;
                 }
                 
              for(var j:uint=0;j<NUM_SNOW;j++){
                var sprite:Sprite=new Sprite();
                var g:Graphics=sprite.graphics;
                g.beginFill(0xffffff);
                g.drawCircle(0,0,2);
                _sprite.push(sprite);
                stage.addChild(_sprite[j])
                _sprite[j].x=Math.random()*stage.stageWidth;
                _sprite[j].y=Math.random()*stage.stageHeight;
                 }
            
            stage.addEventListener(Event.ENTER_FRAME,onEnterFrame);
            
            function onEnterFrame(e:Event):void{
                 for(var i:uint=0;i<NUM_SNOW;i++){
                     if(_bd.getPixel(_sprite[i].x, _sprite[i].y) > 0){
                         _bd.draw(_sprite[i], _sprite[i].transform.matrix)
                         _sprite[i].x=Math.random()*stage.stageWidth;
                         _sprite[i].y=0;
                     }
                    if(_sprite[i].y<stage.stageHeight){
                         _sprite[i].y += 2;
                     }else{
                         _sprite[i].x=Math.random()*stage.stageWidth;
                         _sprite[i].y=0;
                     }
                }
            }

            function showText():void{
                text=new TextField();
                stage.addChild(text);
                text.alpha=0.3;
                text.x=80;
                text.y=200;
                text.width=400;
                text.height=100;
                text.thickness=0.5;
                text.sharpness=3;
                format=new TextFormat();
                format.font="arial";
                format.size=50;
                format.color=0xffffff;
                text.defaultTextFormat=format;
                text.text="Dj Akira Sada";
            }
        }
    }
}