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

color

Get Adobe Flash player
by resense 19 Mar 2009
package {
  import flash.events.*;
  import flash.display.*;
  import flash.external.ExternalInterface;
 
  public class sk007 extends Sprite {

    private var bmpdata_:BitmapData;
    private var sw_:uint,sh_:uint;
    private var p_:Number;

    public function _trace(str:*):void {
      ExternalInterface.call('console.log',str);
    }
    public function sk007() {
      addEventListener(Event.ADDED_TO_STAGE, added_to_stage);
    }
    public function added_to_stage(evt:Event):void {
      //
      sw_ = stage.stageWidth;
      sh_ = stage.stageHeight;
      //
      p_ = 0;
      //
      bmpdata_ = new BitmapData(100,100,false);
      var bmp:Bitmap = new Bitmap(bmpdata_);
      bmp.width = sw_;
      bmp.height = sh_;
      addChild(bmp);
      update();

      addEventListener(Event.ENTER_FRAME, loop);
    }
    public function update():void {
      var b:uint = Math.floor((Math.sin(p_)+1)/2*0xff);
      for(var x:Number=0;x<100;x++) {
        var r:uint = Math.floor((Math.sin(x/100)+1)/2*0xff);
        for(var y:Number=0;y<100;y++) {
          var g:uint = Math.floor((Math.sin(y/100)+1)/2*0xff);
          var c:uint = r<<16|g<<8|b;
          bmpdata_.setPixel(x,y,c);
        }
      }
    }
    public function loop(evt:Event):void {
      p_ += 0.05;
      update();
    }

  }
}