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

Watchman minimal

Original wallpaper:
http://wallbase.cc/wallpaper/122978
Get Adobe Flash player
by WLAD 29 Apr 2013

    Talk

    makc3d at 29 Apr 2013 15:24
    let me introduce you to this helpful function: http://goo.gl/7ennk
    Embed
package {import flash.display.Sprite;import flash.events.Event;[SWF(backgroundColor=0x84B7EE, width=465, height=456, frameRate=60)]public class FakeStage extends Sprite {
    public var bgColor:uint = 0x84B7EE;            
public function FakeStage() {stage ? init() : addEventListener(Event.ADDED_TO_STAGE,init);} private function init(e:Event = null):void {removeEventListener(Event.ADDED_TO_STAGE,init);fillBg();addChild(new Main());stage.addEventListener(Event.RESIZE,fillBg);}private function fillBg(e:Event=null):void{graphics.clear();graphics.beginFill(bgColor);graphics.drawRect(0,0,stage.stageWidth,stage.stageHeight);graphics.endFill();}}}

import net.hires.debug.Stats;
import flash.display.Sprite;
import flash.display.Graphics;
import flash.events.Event;
import com.bit101.components.*;

class Main extends Sprite
{
    //Private variables.
    private var g:Graphics;  
    
    //Default draw variables.
    private var drw_lt:Number = 9;//       Line thikness.
    private var drw_lc:Number = 0x0; //    Line color.
    private var drw_fc:Number = 0x0;//    Fill color.  
    
    //Stage variables.
    private var w:Number, h:Number, w2:Number, h2:Number, 
                min:Number, max:Number, min2:Number, max2:Number;          
    private function updateVars(e:Event = null):void
    {
        w = stage.stageWidth;   h = stage.stageHeight;
        w2 = w / 2;             h2 = h / 2;
        min = w > h ? h : w;    max = w > h ? w : h;
        min2 = min / 2;         max2 = max / 2;
        
        initVars();
    }

    
    public function Main()    {
        addEventListener(Event.ADDED_TO_STAGE,init);} private function init(e:Event):void {removeEventListener(Event.ADDED_TO_STAGE,init);        
                
        //Code stat's here...
        
        //Temp
        //new Label(this,addChild(new Stats()).width + 5,5,"What colort?  0x" + color(132,183,238).toString(16).toUpperCase());
        
        
        //Init draw target.
        g = this.graphics;
        
        //On stage resize change variables.
        stage.addEventListener(Event.RESIZE,updateVars);
        updateVars();
        
        //Start main loop.
        addEventListener(Event.ENTER_FRAME,loop);    
    }
    
    private var a:Number = 0,     //Alpha in radians
                s:Number,     //Speed in radians/frame
                csr:Number,   //Circle small radius
                cbr:Number,   //Circle Big radius.
                csrd:Number,  //Circle small radius dynamic.
                rto1:Number = .75, //Ratio 1
                rto2:Number = .12; //Ratio 2
    private function initVars():void
    {
        //(Frequency of 1.333 Hz)
        var f:Number = 1.333;
        //note changing the framerate won't make any visual changes to the speed value (it depands on the stage frame rate).
        s = ((f * 360) * Math.PI / 360) / stage.frameRate;
        
        cbr = min2 * rto1;
        csr = min2 * rto2;
    }

    private var rx:Number;
    private var ry:Number;
    
    private function loop(e:Event):void
    {
        //TODO: fix?...
        csrd = (a - Math.PI) / (Math.PI);
        csrd = .6 * csrd + .4;
        csrd *= csr;
        
        rx = rnd(2);
        ry = rnd(2);
        
        a += s;
        a = a > Math.PI * 2 ? a - Math.PI * 2 : a;
        
        g.clear();
        g.lineStyle(drw_lt,drw_lc);
        g.drawCircle(w2 + rx, h2 + ry, cbr);
        
        g.beginFill(drw_fc);
        g.drawCircle(w2 - rx,h2 - ry, csr);
        g.endFill();
        
        g.beginFill(drw_fc);
        g.drawCircle(w2 + Math.cos(a) * cbr,h2 + Math.sin(a) * cbr,csr);
        g.endFill();
        
        g.beginFill(drw_fc);
        g.drawCircle(w2 + Math.cos(a) * cbr,h2 + Math.sin(a + Math.PI * 2 / 3) * cbr,csr);
        g.endFill();
        
        g.beginFill(drw_fc);
        g.drawCircle(w2 + Math.cos(a + Math.PI * 2 / 3) * cbr,h2 + Math.sin(a - + Math.PI / 2) * cbr,csrd);
        g.endFill();
        
        g.beginFill(drw_fc);
        g.drawCircle(w2 + Math.cos(-a + Math.PI / 2) * cbr,h2 + Math.sin(-a + Math.PI /  2) * cbr,csr);
        g.endFill();
    }

    
    private function rnd(v:Number):Number
    {
        return Math.random() * v * 2 - v;
    }

    
    private function color(r:Number,g:Number,b:Number):Number
    {
        return (r << 16) | (g << 8) | (b);
    }
}