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

CrossDrawer

Get Adobe Flash player
by func09 17 Dec 2008
    Embed
package {
  
  import flash.display.*;
  import flash.events.*;
  import flash.geom.*;
  
  [SWF(width="465", height="465", backgroundColor="0xFFFFFF", frameRate="31")]
  public class CrossDrawer extends MovieClip {
    
    public var canvas:BitmapData;
    public var element:DisplayObject;
    public var bgColor:uint = 0xFFFFFF;
    
    public function CrossDrawer() {
      setup();
    }
    
    public function setup():void {
      canvas = new BitmapData( stage.stageWidth, stage.stageHeight, false, bgColor );
      addChild( new Bitmap( canvas ) );
      element = new Cross();
      addEventListener( Event.ENTER_FRAME, draw );
      stage.addEventListener( MouseEvent.MOUSE_DOWN, reset );
    }
    
    public function draw( event:Event ):void {
      
      var posX:uint = Math.random() * stage.stageWidth;
      var posY:uint = Math.random() * stage.stageHeight;
      var scale:Number = Math.random() * 10;
      var radian:Number =  Math.random() * 360 * Math.PI / 180;
      
      var matrix:Matrix = new Matrix();
      matrix.rotate( radian );
      matrix.scale( scale, scale );
      matrix.translate( posX, posY );
      var coltrans:ColorTransform = new ColorTransform( 0, 0, 0, 0, Math.random() * 0xFF, 0x00, 0x64, 0xFF * 0.2 );
      canvas.draw( element, matrix, coltrans, null, null, false );
    }
    
    public function reset( event:MouseEvent ):void {
      var rect:Rectangle = new Rectangle( 0, 0, stage.stageWidth, stage.stageHeight);
      canvas.fillRect( rect, bgColor );
    }
    
  }
  
  
}

import flash.display.*;

class Cross extends Sprite {
  public function Cross(){
    graphics.beginFill( 0xFFFFFF );
    graphics.lineTo( 1, 0 );
    graphics.lineTo( 2, 0 );
    graphics.lineTo( 2, 1 );
    graphics.lineTo( 3, 1 );
    graphics.lineTo( 3, 2 );
    graphics.lineTo( 2, 2 );
    graphics.lineTo( 2, 3 );
    graphics.lineTo( 1, 3 );
    graphics.lineTo( 1, 2 );
    graphics.lineTo( 0, 2 );
    graphics.lineTo( 0, 1 );
    graphics.lineTo( 1, 1 );
    graphics.lineTo( 1, 0 );
    graphics.endFill();
  }
}