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

Happy Valentine

Get Adobe Flash player
by mari 14 Feb 2009
package {
  import flash.display.Shape;
  import flash.display.Sprite;
  import flash.events.Event;
  import flash.text.TextField;
  import flash.text.TextFormat;

  [SWF(width="400", height="400", backgroundColor="0xFFFFFF", frameRate="30")]

  public class StValentine extends Sprite {
    private const SCALE:int = 40;
    private var container:Sprite;
    private var tf:TextField;

    public function StValentine() {
      container = new Sprite();
      container.x = stage.stageWidth/2;
      container.y = stage.stageHeight/2;
      addChild(container);
      tf = new TextField();
      tf.x -= 60;
      tf.y += 10;
      tf.text = "Happy Valentine";
      tf.autoSize = "left";
      tf.setTextFormat(new TextFormat("Helvetica", 16, 0xff00ff));
      container.addChild(tf);

      var sp:Shape;
      var r:Number = 0.0, theta:Number = 0.0, z:Number = 0.0;
      for(var i:int=-Math.PI*8; i<=Math.PI*8; i++) {
        for(var j:int=-8; j<=8; j++) {
          theta = i/8;
          z = j/8;
          r = 4*Math.sqrt(1 - z*z)*Math.pow(Math.sin(Math.abs(theta)), Math.abs(theta));
          sp = new Shape();
          sp.graphics.beginFill(0xff007f, 0.5);
          sp.graphics.drawCircle(0, 0, 4);
          sp.graphics.endFill();
          sp.x= SCALE*r*Math.sin(theta);
          sp.y= SCALE*r*Math.cos(theta);
          sp.z= SCALE*z;
          container.addChild(sp);
        }
      }
      addEventListener(Event.ENTER_FRAME, onEnterFrame);
    }
    private function onEnterFrame(e:Event):void {
      container.rotationY++;
      container.rotationX++;
    }
  }
}