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

StarField

Get Adobe Flash player
by raulfpl 27 Feb 2013
    Embed
package {
    import flash.events.Event;
    import flash.display.BitmapData;
    import flash.display.Bitmap;
    import flash.display.Sprite;
    public class StarField extends Sprite {
        public function StarField() {
            // write as3 code here..
            if(!stage)
                addEventListener(Event.ADDED_TO_STAGE, init);
            else
                init();
        }
        private function init():void{
            addChild(new Bitmap(new BitmapData(stage.stageWidth, stage.stageHeight, false, 0)));
            var par:Star = new Star();
            addChild(par);
        }

    }
}
import flash.display.Graphics;
import flash.display.Sprite;

class Star extends Sprite{
    
    public function Star(){
        init();
        
    }
    
    private function init():void
    {
        var gfx:Graphics;
        gfx = this.graphics;
        gfx.beginFill(0xffffff);
        gfx.drawCircle(0,0,1);
        gfx.endFill()
        
        this.y = Math.random() * stage.stageHeight;
        this.x = stage.stageWidth/2;
    }


}