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

forked from: trace current method

Get Adobe Flash player
by makc3d 11 Mar 2011
/**
 * Copyright makc3d ( http://wonderfl.net/user/makc3d )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/2xD6
 */

// forked from 9re's trace current method
package {
	import flash.system.Capabilities;
    import flash.text.TextField;
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        private var traceField:TextField;
        public function FlashTest() {
            traceField = new TextField;
            traceField.width = traceField.height = 465;
            addChild(traceField);
            methodA();
        }
        
        private function methodA():void {
            traceNow('1', 2);
            methodB();
        }
        
        private function methodB():void {
            traceNow(new Date);
        }
        
        private function traceNow (...msg:Array):void {
			var at:String = "";
			if (Capabilities.isDebugger)
				at = (new Error).getStackTrace ().split ('\n') [2];
            
			traceField.appendText((msg ? msg.join(' ') : '') + at + '\n');
        }
        
    }
}