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

flash on 2010-7-24

Get Adobe Flash player
by hacker_rth_icgc 24 Jul 2010
    Embed
/**
 * Copyright hacker_rth_icgc ( http://wonderfl.net/user/hacker_rth_icgc )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/53BD
 */

package {
    import flash.display.*;
    import __AS3__.vec.*;
    import flash.events.*;
    import flash.text.*;

    public class Main extends Sprite {

        private var bmpBitmap:Bitmap;
        private var bmpData:BitmapData;
        private var sMask:Sprite;
        private var pal:Vector.<uint>;
        private var splitPal:Vector.<uint>;
        private var fbLen:uint;
        private var fb:Vector.<uint>;
        private var cosinus:Vector.<uint>;
        private var t1:int;
        private var t2:int;
        private var t3:int;
        private var t4:int;
        private var p1:int;
        private var p2:int;
        private var p3:int;
        private var p4:int;

        public function Main():void{
            stage.scaleMode = StageScaleMode.NO_SCALE;
            stage.align = StageAlign.TOP_LEFT;
            this.bmpBitmap = new Bitmap();
            this.bmpData = new BitmapData(320, 60, true, 0);
            this.sMask = new Sprite();
            this.pal = new Vector.<uint>(0x0100, true);
            this.splitPal = new Vector.<uint>(0x0300, true);
            this.cosinus = new Vector.<uint>(0x0400, true);
            super();
            if (stage){
                this.init();
            } else {
                addEventListener(Event.ADDED_TO_STAGE, this.init);
            };
        }
        private function init(e:Event=null):void{
            if (e){
                removeEventListener(Event.ADDED_TO_STAGE, this.init);
            };
            this.blendMode = BlendMode.LAYER;
            this.fbLen = (this.bmpData.width * this.bmpData.height);
            this.fb = new Vector.<uint>(this.fbLen, true);
            var i:int;
            while (i < this.cosinus.length) {
                this.cosinus[i] = (60 * Math.cos(((i * Math.PI) / 64)));
                i++;
            };
            this.createPal();
            this.bmpBitmap.bitmapData = this.bmpData;
            this.addChild(this.bmpBitmap);
            this.width = stage.stageWidth;
            this.height = stage.stageHeight;
            var tf:TextField = new TextField();
            var tfmt:TextFormat = new TextFormat();
            tfmt.size = 20;
            tfmt.bold = true;
            tfmt.align = "center";
            tf.htmlText = "<b>apples is <u>this</u> gay.</b>";
            tf.setTextFormat(tfmt);
            tf.selectable = false;
            tf.width = ((stage.stageWidth / 2) + 4);
            tf.height = (this.height + 4);
            tf.x = -2;
            tf.y = -2;
            //this.sMask.addChild(tf);
            this.sMask.blendMode = BlendMode.ALPHA;
            this.addChild(this.sMask);
            addEventListener(Event.ENTER_FRAME, this.enterFrame);
        }
        private function createPal():void{
            var x:int;
            var y:int;
            var i:int;
            x = 0;
            y = 0;
            while (x < (63 * 3)) {
                this.splitPal[x] = y;
                x = (x + 3);
                y++;
            };
            x = (63 * 3);
            y = 63;
            while (x < (127 * 3)) {
                this.splitPal[x] = y;
                x = (x + 3);
                y--;
            };
            x = (127 * 3);
            y = 0;
            while (x < (191 * 3)) {
                this.splitPal[(x + 1)] = y;
                x = (x + 3);
                y++;
            };
            x = (191 * 3);
            y = 191;
            while (x < (0xFF * 3)) {
                this.splitPal[(x + 1)] = y;
                x = (x + 3);
                y--;
            };
            var l:int;
            i = 0;
            while (i < 0x0100) {
                this.pal[i] = (0xFF << 24);
                var _temp1 = l;
                l = (l + 1);
                this.pal[i] = (this.pal[i] + (this.splitPal[_temp1] << 16));
                var _temp2 = l;
                l = (l + 1);
                this.pal[i] = (this.pal[i] + (this.splitPal[_temp2] << 8));
                var _temp3 = l;
                l = (l + 1);
                this.pal[i] = (this.pal[i] + this.splitPal[_temp3]);
                i++;
            };
        }
        private function enterFrame(e:Event):void{
            this.bmpData.lock();
            this.doPlasma();
            this.bmpData.setVector(this.bmpData.rect, this.fb);
            this.bmpData.unlock();
        }
        private function doPlasma():void{
            var x:int;
            var y:int;
            var col:uint;
            var v:int;
            this.t1 = this.p1;
            this.t2 = this.p2;
            y = 0;
            while (y < this.bmpData.height) {
                this.t3 = this.p3;
                this.t4 = this.p4;
                x = 0;
                while (x < this.bmpData.width) {
                    col = ((((this.cosinus[this.t1] + this.cosinus[this.t2]) + this.cosinus[this.t3]) + this.cosinus[this.t4]) % 0x0100);
                    this.fb[v] = this.pal[col];
                    v++;
                    this.t3 = (this.t3 + 1);
                    if (this.t3 > (this.cosinus.length - 1)){
                        this.t3 = (this.t3 - (this.cosinus.length - 1));
                    };
                    this.t4 = (this.t4 + 3);
                    if (this.t4 > (this.cosinus.length - 1)){
                        this.t4 = (this.t4 - (this.cosinus.length - 1));
                    };
                    x++;
                };
                this.t1 = (this.t1 + 2);
                if (this.t1 > (this.cosinus.length - 1)){
                    this.t1 = (this.t1 - (this.cosinus.length - 1));
                };
                this.t2 = (this.t2 + 1);
                if (this.t2 > (this.cosinus.length - 1)){
                    this.t2 = (this.t2 - (this.cosinus.length - 1));
                };
                y++;
            };
            this.p1 = (this.p1 + 1);
            if (this.p1 > (this.cosinus.length - 1)){
                this.p1 = (this.p1 - (this.cosinus.length - 1));
            };
            this.p2 = (this.p2 - 2);
            if (this.p2 < 0){
                this.p2 = (this.p2 + (this.cosinus.length - 1));
            };
            this.p3 = (this.p3 + 3);
            if (this.p3 > (this.cosinus.length - 1)){
                this.p3 = (this.p3 - (this.cosinus.length - 1));
            };
            this.p4 = (this.p4 - 4);
            if (this.p4 < 0){
                this.p4 = (this.p4 + (this.cosinus.length - 1));
            };
        }

    }
}//package