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

code on 2008-12-31

Get Adobe Flash player
by gyuque 01 Jan 2009
    Embed
package{

import flash.display.*;
import flash.events.*;
import flash.geom.*;

[SWF(frameRate="30")]    
public class X extends Sprite
{
    private static const C:uint = 0x776030;
    private var bd:BitmapData;
    private var yb:BitmapData = new SpritePool(YUNO);
    private var count:int = 0;
    private var mGPt:Point = new Point();
    private var mt:int = 0;
    private var dir:Boolean = true;
    private var vy:Number = -2;

    function X()
    {
        bd = new BitmapData(600, 600, false, 0xddd5c3);
        var b:Bitmap = new Bitmap(bd);
        addChild(b);

        addEventListener(Event.ENTER_FRAME, tick);
    }

    private function tick(e:Event):void
    {
        if (dir) {
            mt++;
            if (mt == 20) {
                dir = false;
                vy = -15;
                mGPt.x = Math.random()*480;
                mGPt.y = Math.random()*180 + 190;
            }
        } else {
            mt--;
            if (mt == -19) {
                dir = true;
            }
        }

        mGPt.y += vy;
        vy += 0.8;
        if (mGPt.y > 450) {
            mGPt.y = 450;
            vy *= -0.6;
        }

        count++;
        bd.fillRect(new Rectangle(0, 0, 600, 600), 0xddd5c3);

        var i:int, k:int, xx:int, xy:int;
        for (k = 0;k < 80;k++) {
           for (i = 0;i < 70;i++) {
                xx = i*6 + 10;
    
                var px:int = yb.getPixel(i, k) & 0xff;
                var val:int = (px>90) ? 2 : (px>30) ? 1 : 0;
                var t:Number;
                t = mt*0.09 - Math.cos(k*0.3)*0.2 -  - Math.sin(k*0.4)*0.2 - 0.1; 
                if (t>1) t = 1;
                if (t<0) t = 0;

 
                  xy = k*6 + 10;
                  xx = mGPt.x * (1-t) + xx*t;
                  xy = mGPt.y * (1-t) + xy*t;

                if (val > 0) {   
                    bd.setPixel(xx, xy, C);
                    bd.setPixel(xx+1, xy+1, C);
                    bd.setPixel(xx+2, xy+2, C);

                    bd.setPixel(xx+2, xy, C);
                    bd.setPixel(xx, xy+2, C);
                    if (val > 1) {
                        bd.setPixel(xx-1, xy-1, C);
                        bd.setPixel(xx+3, xy+3, C);
                        bd.setPixel(xx+3, xy-1, C);
                        bd.setPixel(xx-1, xy+3, C);

                        xx++;
                        bd.setPixel(xx, xy, C);
                        bd.setPixel(xx+1, xy+1, C);
                        bd.setPixel(xx+2, xy+2, C);

                        bd.setPixel(xx+2, xy, C);
                        bd.setPixel(xx, xy+2, C);

                        bd.setPixel(xx-1, xy-1, C);
                        bd.setPixel(xx+3, xy+3, C);
                        bd.setPixel(xx+3, xy-1, C);
                        bd.setPixel(xx-1, xy+3, C);
                    }
                }
            }
        }
    }
}

}


class SpritePool extends flash.display.BitmapData
{
	import flash.utils.ByteArray;

	function SpritePool(src:*)
	{
		var ba:ByteArray = B64.decode(src.DATA);
		ba.uncompress();

		var w:int = ba.readUnsignedShort();
		var h:int = ba.readUnsignedShort();

		super(w, h, true, 0);

		var pal_length:int = ba.readUnsignedByte();
		var pal:Array = new Array(pal_length);
		for (var i:int = 0;i < pal_length;i++) {
			pal[i] = ba.readUnsignedInt();
		}

		lock();
		var x:int, y:int, k:uint;
		for (y = 0;y < h;y++) {
			for (x = 0;x < w;x += 2) {
				k = ba.readUnsignedByte();
				setPixel32(x  , y, uint(pal[k&0x0f]));
				setPixel32(x+1, y, uint(pal[(k&0xf0)>>4]));
			}
		}
		unlock();
	}
}

class B64
{
	import flash.utils.ByteArray;
	public static function decode(raw:String):ByteArray
	{
		var res:ByteArray = new ByteArray();
		
		var d1:int, d2:int, d3:int, d4:int;
		var len:int = raw.length;
		for (var i:int = 0;i < len;i += 4) {
			d1 = v(raw.charCodeAt(i  )); d2 = v(raw.charCodeAt(i+1));
			d3 = v(raw.charCodeAt(i+2)); d4 = v(raw.charCodeAt(i+3));
      		
			if (d2 == 64) break;
			res.writeByte( (d1 << 2) + ((d2 & 0x30) >> 4) );

			if (d3 == 64) break;
			res.writeByte( ((d2 & 0x0f) << 4) + ((d3 & 0x3c) >> 2) );

			if (d4 == 64) break;
			res.writeByte( ((d3 & 0x03) << 6) + d4 );
		}
		
		res.position = 0;
		return res;
	}

	public static function v(c:int):int {
		return (c==61) ? 64 : (c>=65 && c<=90) ? (c-65) : (c>=97 && c <= 122) ? (c-71) : (c>=48) ? (c+4) : (c==43) ? 62 : 63;
	}
}



class YUNO
{
    public static const DATA:String =
'eNqFlkmW1DAMhiWzB1knsHQalqzhcWR43KjRLzmOkxo61fW6KvlK82D6Qd+/fHzrXz9+/f758fffH3q4eu9Mn1zSvWvH31vM3fu8XF8Lc+379VLn/XpqpugDqE+lPcp7ptrprlSeSTR+ECVPTJS7F0wl364Y3zhe7red456eWGbCOnUieuLKYYb1wcyDaUB+BZ15w6Zb'+
'SjAHUCPIvQiM1Hv9Bk+Lo0yz7lwklR0fRrwIVluDBSiFPXsS7yYIQ7wEnDYSg6ypWM7g4VsL86CSFInWJ8ljcMZBWnJ+6NRL2YwMqQWJJEc8FmcXrlMZbX0WPRhTvUVGsjACCFJHckDUbwaWuMnBT4WoCKpeDJzi4q4uzp9wQ5qVeSFxchYfsvXMlmIdBHM2bkqFwI1j'+
'lYMLMeUC0uvhiZrpwY30EVxo0pThPPBPoTm99kgntwEPPAz3llx3DhU2YGMqSA5uhGUO21uqDS4Um4SikhlCEJd0N8xROID0eRQbjBDNqMJDVKXDU4fRbYBrxrA1JCGNniiqwJHY5FQ8yDYmByUZhp2L3OJJcFFgXl/AVWJ441KIBEfRY/GFoRomZeYknqTeDF84UZ09'+
'OUtvc4pQhjOvyE14f3BaXI1Y6IVLuBlxxhjUOYH94BBqnlyr+zcOYUpngpPibHJkOvWWuxWXriMFI2WTk5074hxphA/g0hfOyZpSi7PK2+L05LLZi7NiwFLlTF0Orpo6DbZedYXABBK2NhO3nYuqctXVwhHAFgCCe+WylXSbbtJGcOEknvC2EGvZnTOhyQjFMH3jymdb'+
'QzBnAmzLEtHbWtQ+G876nMsxHE0v0mT4KS6TNJTWuj2n2GzWOTksc071g9wkvJasntaxZIXIw8YT5hwk24YdObLi07ZSiEVSq26buCag8FqOXBmxrNNzy9UcP+e/VeWj4FKcVS8IZZSm1mjLXtHz4/RhiFoNe707IhgHXl05895zTfE1Z5KFBBNh3diOJHaLDEadMk4X'+
'rY/tuNQfsgsOo5C2KmKYoRf7tOpiN1wQQoxKPjEMpTR/OyEIVmmn1SA5+ZXW4l1VnvuXhiEcqbPfavb8jWTr2qp3f3sCHHCHe7r69kAZU3eeEj/hsDvS7/dc9JMdJwx5TQ1in0oxW1+fdtEGuR/ruLqe/QeFSp5W';
}