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

trace Template

trace表示がなくテストがやりにくいので、テンプレートを持っておく。
Get Adobe Flash player
by whirlpower 14 Nov 2010
    Embed
/**
 * Copyright whirlpower ( http://wonderfl.net/user/whirlpower )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/iAMe
 */

package
{
    import flash.display.Sprite;
    public class FlashTest extends Sprite
    {
        public function FlashTest()
        {
            Tracer.init( stage );
            Tracer.add( "trace test" );
            Tracer.add( "テスト用 テンプレート" );
            
        }
    }
}

    import flash.display.*;
    import flash.text.*;
    
    internal class Tracer
    {
        private static var text : String = "";
        private static var viewText : TextField = new TextField();
  
        public static function init( _container:DisplayObjectContainer ):void
        {
            viewText.defaultTextFormat = new TextFormat( "MS UI Gothic", 12, 0xDDDDDD );
            viewText.width  = 465-10;
            viewText.height = 465-10;
            viewText.selectable = false;
            viewText.text = "view trace";
            viewText.x = 5;
            viewText.y = 5;
            viewText.mouseWheelEnabled = true;
            
            var s:Shape = new Shape();
            s.graphics.clear();
            s.graphics.beginFill( 0x000000, 0.5 );
            s.graphics.drawRect(0, 0, 456, 456 );
            s.graphics.endFill();
            
            var c:Sprite = new Sprite();
            c.mouseChildren = false;
            c.mouseEnabled  = false;
            
            c.addChild( s );
            c.addChild( viewText );
            
            _container.addChild( c );
            
        }
        
        public static function add( t:String = "tracer" ):void
        {
            text += t + "\n";
            viewText.text = text;
            viewText.scrollV += 1;
        }
    }