Log

by paulstamp1
@paulstamp

Log, trace, output what ever you want to call it.....
♥0 | Line 35 | Modified 2013-02-25 18:25:58 | MIT License
play

ActionScript3 source code

/**
 * Copyright paulstamp1 ( http://wonderfl.net/user/paulstamp1 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/vn9G
 */

// forked from paulstamp1's Orbit
/**                                                          
     _____ _____ _____ __       _____ _____ _____ _____ _____ 
    |  _  |  _  |  |  |  |     |   __|_   _|  _  |     |  _  |
    |   __|     |  |  |  |__   |__   | | | |     | | | |   __|
    |__|  |__|__|_____|_____|  |_____| |_| |__|__|_|_|_|__|   
    @paulstamp
                                                       
    Log, trace, output what ever you want to call it.....

*/
package {
    import flash.display.Sprite;
    
    public class FlashTest extends Sprite {
        public function FlashTest() {
            // write as3 code here..
            Log.setup( stage );
            Log.trace( "HELLO WORLD" ); 
            Log.trace( "TEST2" );  
            Log.trace( "booooooo............." );
                    
        }
    }
}
import flash.text.TextFormat;

import flash.display.DisplayObjectContainer;
import flash.events.Event;
import flash.display.Sprite;
import flash.text.TextField;

class Log {
    
    private  static var _txtField:TextField = new TextField();
    private  static var _container:DisplayObjectContainer;
    
    public static function setup( container:DisplayObjectContainer ):void {
         _container = container;
         _container.addEventListener( Event.ENTER_FRAME, onEnterFrame );
         _txtField.defaultTextFormat = new TextFormat( "_sans", 9, 0x000000, true );         
         _txtField.alpha = 0.8;
    }
    
    public static function trace( value:String ):void {         
        _txtField.appendText( value );
        _txtField.appendText( "\n" );
    }

    private static function onEnterFrame( event:Event ):void { 
        _container.addChild( _txtField );
        _txtField.width = _container.stage.stageWidth;
        _txtField.height = _container.stage.stageHeight;
    }


}