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 2014-5-9

Get Adobe Flash player
by sp2012 09 May 2014
    Embed
/**
 * Copyright sp2012 ( http://wonderfl.net/user/sp2012 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/v1JSs
 */

package {
    import flash.display.Sprite;
        import flash.events.*;

    import flash.text.TextField;
    
import flash.xml.XMLDocument;
    
    public class FlashTest extends Sprite {
        public function FlashTest() {
            // write as3 code here..

inittrace(stage);
var xml_escape_me:String = "< > & ' "";
            
            trace(1); 
            trace(htmlUnescape(xml_escape_me));
        }
        
public function htmlUnescape(str:String):String
{
    return new XMLDocument(str).firstChild.nodeValue;
}        
    }
}



/////  WONDERFL TRACE /////



import flash.display.Sprite;

import flash.display.Stage;

import flash.text.TextField;

import flash.text.TextFormat;





function inittrace(s:Stage):void

{

    WTrace.initTrace(s);

}



//global trace function

var trace:Function;



//wtreace class

class WTrace

{

        private static var FONT:String = "Fixedsys";

        private static var SIZE:Number = 12;

        private static var TextFields:Array = [];

        private static var trace_stage:Stage;

        

        public static function initTrace(stg:Stage):void

        {

            trace_stage = stg;

            trace = wtrace;

        }

        

        private static function scrollup():void

        {

            // maximum number of lines: 100

            if (TextFields.length > 100) 

            {

                var removeme:TextField = TextFields.shift();

                trace_stage.removeChild(removeme);

                removeme = null;

            }

            for(var x:Number=0;x<TextFields.length;x++)

            {

                (TextFields[x] as TextField).y -= SIZE*1.2;

            }

        }

    

        public static function wtrace(... args):void

        {

        

            var s:String="";

            var tracefield:TextField;

            

            for (var i:int;i < args.length;i++)

            {

                // imitating flash:

                // putting a space between the parameters

                if (i != 0) s+=" ";

                s+=args[i].toString();

            }

            



            tracefield= new TextField();

            tracefield.autoSize = "left";

            tracefield.text = s;

            tracefield.y = trace_stage.stageHeight - 20;



            var tf:TextFormat = new TextFormat(FONT, SIZE);

            tracefield.setTextFormat(tf);

            trace_stage.addChild(tracefield);

            scrollup();                      

            TextFields.push(tracefield);

            

        }

}