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

map it !

Get Adobe Flash player
by yukifuruyoru 31 May 2010
    Embed
// forked from yukifuruyoru's myTempla
package {
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        public function FlashTest() {
			inittrace(stage);
			
			var sample1:Dna=new Dna([[25,25],[0,4278190080,4278255360,4294901760,4278190335],[1,1,1,1,1,1,1,0,1,1,1,1,0,1,1,0,0,0,1,1,1,1,1,1,1],[1,0,0,0,0,0,1,0,0,0,0,1,1,1,0,0,0,0,1,0,0,0,0,0,1],[1,0,3,3,3,0,1,0,0,1,0,1,0,1,1,0,0,0,1,0,2,2,2,0,1],[1,0,3,3,3,0,1,0,0,0,1,1,0,1,0,1,1,0,1,0,2,2,2,0,1],[1,0,3,3,3,0,1,0,0,0,1,1,1,0,0,0,1,0,1,0,2,2,2,0,1],[1,0,0,0,0,0,1,0,0,1,0,1,0,0,1,0,1,0,1,0,0,0,0,0,1],[1,1,1,1,1,1,1,0,1,0,0,0,1,0,1,0,1,0,1,1,1,1,1,1,1],[0,0,0,0,0,0,0,0,1,1,0,0,1,1,1,1,1],[1,1,0,1,1,0,1,0,0,1,0,0,1,0,0,0,1,0,1,0,0,0,0,0,1],[0,1,1,1,0,1,0,1,1,0,1,0,0,1,1,1,1,0,0,1,1,1,1,1],[0,0,0,0,0,0,1,0,1,1,0,0,1,1,0,1,0,0,0,1,0,1,0,0,1],[0,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,1,0,1,1,1,1,1,1],[1,0,0,0,1,1,1,0,1,1,1,0,0,1,1,0,1,0,1,1,0,0,0,0,1],[0,1,1,0,1,0,0,0,1,1,1,0,1,0,1,1,1,0,0,0,1,0,0,1],[0,0,1,0,1,0,1,1,0,0,0,0,0,0,1,1,1,1,1,0,1,1,1,1,1],[0,1,1,1,1,0,0,0,1,1,0,0,1,1,1,1,0,0,1,1,1,0,1,0,1],[0,1,1,1,1,1,1,1,0,0,0,1,1,0,0,1,1,1,1,1,1,0,1,1],[0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,1,0,0,0,1,0,0,1],[1,1,1,1,1,1,1,0,0,1,0,0,1,1,1,0,1,0,1,0,1,1,0,0,1],[1,0,0,0,0,0,1,0,0,1,0,1,0,1,0,1,1,0,0,0,1,0,0,0,1],[1,0,4,4,4,0,1,0,1,1,0,1,0,1,0,1,1,1,1,1,1,1,0,1,1],[1,0,4,4,4,0,1,0,1,0,0,0,1,1,0,0,0,1,1,1,0,1,0,1,1],[1,0,4,4,4,0,1,0,0,1,1,1,0,1,0,1,0,1,0,1,1,0,1,1,1],[1,0,0,0,0,0,1,0,1,1,0,1,1,1,0,1,0,0,1,1,1,0,1,1,1],[1,1,1,1,1,1,1,0,1,1,1,1,1,1,0,0,1,0,1,0,0,1,0,0,1]]);

			var editor:Editor=new Editor(stage);
			editor.dnaLoad(sample1);
            
        }
    }
}


import flash.display.Shape;
import flash.display.Stage;
import flash.display.Sprite;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.geom.Matrix;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.system.System;

import flash.display.BitmapData;
class Editor extends Sprite{
	public var k:uint=1;
	private var icolor:uint=0;
	private var dna:Dna=new Dna([[16,16],[0x00000000,0xFF000000],[0]]);
	private var stg:Stage;
	private var plate:Sprite=new Sprite();
	private var salida:Sprite=new Sprite();
	private var nuevo:Sprite=new Sprite();
	private var pbox:Sprite=new Sprite();
	private var magni:Sprite=new Sprite();
	private var navi:Sprite=new Sprite();
	private var cur:Shape=new Shape();
	private var gen:Sprite=new Sprite();
	private var genready:Boolean=false;
	private var t1:TextField=texmex();
	private var t2:TextField=texmex();
	private var ink:Sprite=new Sprite();
	private var inkready:Boolean=false;
	private var t3:TextField=new TextField();
	private var leer:Sprite=new Sprite();
	private var lector:Sprite=new Sprite();
	private var lecready:Boolean=false;
	private var t4:TextField=texmex();
	
	public function dnaLoad(d:Dna):void{
		dna=d;
		repbox();
		show(1);
		center();
	}
	
	public function Editor(s:Stage):void{
		stg=s;
		stg.addChild(this);
		initplate();
		initnuevo();
		initleer();
		initsalida();
		initmagni();
		initnavi();
		initpbox();
		show(1);
		center();
	}
	private function initplate():void{
		addChild(plate);
		plate.addEventListener(MouseEvent.MOUSE_DOWN, onPlateClick);
		plate.x=50,plate.y=50;
	}
	private function onPlateClick(e:MouseEvent):void{
		var p:uint=((plate.mouseX)/k);
		var q:uint=((plate.mouseY)/k);
		
		if(p<dna.size[0]&&q<dna.size[1]){
			inject(p,q,icolor);
		}
		show(k);
	}
	private function initleer():void{
		rr(leer,50,20,10);
		leer.x=400;
		leer.y=425;
		addChild(leer);
		initlector();
		leer.addEventListener(MouseEvent.MOUSE_DOWN, onLeerClick);
	
	}
	private function onLeerClick(e:MouseEvent):void{
		if(!lecready){
			lecready=true;addChild(lector);
			if(genready){genready=false;removeChild(gen);}
		}
		else{lecready=false;removeChild(lector);}
		
	}

	private function initlector():void{
		rr(lector,20,20,10);
		lector.x=leer.x-120;
		lector.y=leer.y;
		t4.x=25;
		t4.width=90;
		t4.text="";
		t4.restrict="0-9,\,,[,],x,X,a-f,A-F";
		t4.maxChars=0;
		lector.addChild(t4);
		lector.addEventListener(MouseEvent.MOUSE_DOWN, onLectorClick);
	
	}
	
	private function onLectorClick(e:MouseEvent):void{
		if(lector.mouseX<20){
			var sol:Array=strdecoder(t4.text);
			trace(sol);
		}
	}
	private function strdecoder(str:String):Array{
		var dum:Array=new Array([0]);
		var err:Boolean=false;
		if(dum.length<12){err=true;}
		if(err){dum=new Array(["error!"]);}
		return dum;
	}
	private function initnuevo():void{
		rr(nuevo,50,20,10);
		addChild(nuevo);
		nuevo.x=400;nuevo.y=400;
		nuevo.addEventListener(MouseEvent.MOUSE_DOWN,onNuevoClick);
		initgen();
		
		var deco:Bitmap=new Bitmap(dmap([[16,16],[0,4278190080],[0,0,1,1,1,1,1,1,1,1],[0,0,1,0,0,0,0,0,1,0,1],[0,0,1,0,0,0,0,0,1,0,0,1],[0,0,1,0,0,0,0,0,1,0,0,0,1],[0,0,1,0,0,0,0,0,1,0,0,0,0,1],[0,0,1,0,0,0,0,0,1,1,1,1,1,1],[0,0,1,0,0,0,0,0,0,0,0,0,0,1],[0,0,1,0,0,0,0,0,0,0,0,0,0,1],[0,0,1,0,0,0,0,0,0,0,0,0,0,1],[0,0,1,0,0,0,0,0,0,0,0,0,0,1],[0,0,1,0,0,0,0,0,0,0,0,0,0,1],[0,0,1,0,0,0,0,0,0,0,0,0,0,1],[0,0,1,0,0,0,0,0,0,0,0,0,0,1],[0,0,1,0,0,0,0,0,0,0,0,0,0,1],[0,0,1,0,0,0,0,0,0,0,0,0,0,1],[0,0,1,1,1,1,1,1,1,1,1,1,1,1]]));
		
		deco.x=18;deco.y=2;
		nuevo.addChild(deco);
		
	}
	private function onNuevoClick(e:MouseEvent):void{
		if(!genready){
			t1.borderColor=0xcccccc;
			t2.borderColor=0xcccccc;
			addChild(gen);
			genready=true;
			if(lecready){lecready=false;removeChild(lector);}
		}
		else{removeChild(gen);genready=false;}
	}
	private function initgen():void{
		rr(gen,20,20,10);
		gen.x=nuevo.x-120;gen.y=nuevo.y;
		t1.x=25;t2.x=73;
		gen.addChild(t1);
		gen.addChild(t2);
		gen.addEventListener(MouseEvent.MOUSE_DOWN, onGenClick);
	
	}
	
	private function onGenClick(e:MouseEvent):void{
		
		if(gen.mouseX<20){
			var w:uint=uint(t1.text);
			var h:uint=uint(t2.text);
			if(stest(w,h)){
				dnaLoad(new Dna([[w,h],[0,0xFF000000],[0]]));
				genready=false;
				removeChild(gen);
			}
		}
	}
	private function stest(w:uint,h:uint):Boolean{
		var yn:Boolean=true;
		if(!w){yn=false;t1.borderColor=0xff5555}
		if(!h){yn=false;t2.borderColor=0xff5555}
		return yn;
	}
	private function texmex():TextField{
		var format:TextFormat=new TextFormat();
		format.align="right";
		var dum:TextField= new TextField();
		dum.defaultTextFormat=format;
		dum.width=42;dum.height=20;
		dum.border=true;
		dum.borderColor=0xcccccc;
		dum.background=true;
		dum.restrict="0-9";
		dum.maxChars=3;
		dum.type="input";
		
		dum.text="16";
		return dum;
	}
	
	private function initsalida():void{
		salida.buttonMode=true;
		salida.x=16;salida.y=370;
		rr(salida,100,80,20);
		addChild(salida);
		salida.addEventListener(MouseEvent.MOUSE_DOWN, onSalidaClick);


		var deco:Bitmap=new Bitmap(dmap([[32,5],[0,4278190080],[1,1,1,0,1,1,1,0,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1],[1,0,0,0,0,1,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1],[1,0,0,0,0,1,0,0,1,1,0,0,1,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,1],[1,0,0,0,0,1,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1],[1,1,1,0,0,1,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1]]));
		deco.x=32;deco.y=38;
		salida.addChild(deco);
		}
	private function onSalidaClick(e:MouseEvent):void{
		System.setClipboard(dna.code());
	}
	private function initmagni():void{
		magni.x=16;magni.y=16;
		rr(magni,20,60,10);
		magni.graphics.beginBitmapFill(dmap([[20,60],[0,4278190080],[0],[0],[0],[0],[0,0,0,0,0,0,0,0,0,1,1],[0,0,0,0,0,0,0,0,0,1,1],[0,0,0,0,0,0,0,1,1,1,1,1,1],[0,0,0,0,0,0,0,1,1,1,1,1,1],[0,0,0,0,0,0,0,0,0,1,1],[0,0,0,0,0,0,0,0,0,1,1],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0,0,0,0,0,0,1,1,1,1,0],[0,0,0,0,0,1,0,0,0,0,1],[0,0,0,0,0,1,0,0,0,0,1],[0,0,0,0,0,1,0,0,0,0,1],[0,0,0,0,0,1,0,0,0,0,1],[0,0,0,0,0,0,1,1,1,1,1],[0,0,0,0,0,0,0,0,0,0,0,1],[0,0,0,0,0,0,0,0,0,0,0,0,1],[0,0,0,0,0,0,0,0,0,0,0,0,0,1],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0,0,0,0,0,0,0,1,1,1,1,1,1],[0,0,0,0,0,0,0,1,1,1,1,1,1],[0],[0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]]));
		magni.graphics.drawRect(0,0,20,60);
		magni.graphics.endFill();
		addChild(magni);

		magni.addEventListener(MouseEvent.MOUSE_DOWN, onMagniClick);
		
		
	}
	private function onMagniClick(e:MouseEvent):void{
		var h:uint=magni.mouseY;
		var prek:uint=k;
		if(h<30){k*=2;}else{if(k>1){k=Math.round(k/2);}}
		if(k!=prek){
			magcent(prek);
			show(k);
		}
	}
	
	private function magcent(prek:uint):void{
		var p:Number=(465/2-plate.x)/prek;
		var q:Number=(465/2-plate.y)/prek;
		var n1:Number=Math.round(plate.x+p*k-465/2);
		var n2:Number=Math.round(plate.y+q*k-465/2);
		plate.x-=n1;
		plate.y-=n2;
	}
	
	private function initnavi():void{
		navi.x=410;navi.y=56;
		navi.graphics.beginFill(0xcccccc);
		navi.graphics.drawRoundRect(-10,-40,20,80,10);
		navi.graphics.drawRoundRect(-40,-10,80,20,10);
		navi.graphics.endFill();
		navi.graphics.beginFill(0xffffff);
		navi.graphics.drawCircle(0,0,16);
		navi.graphics.beginFill(0xcccccc);
		navi.graphics.drawCircle(0,0,10);
		addChild(navi);
		navi.addEventListener(MouseEvent.MOUSE_DOWN, onNaviClick);

	}
	private function onNaviClick(e:MouseEvent):void{
		var p:int=navi.mouseX;
		var q:int=navi.mouseY;
		if(Math.abs(p)+Math.abs(q)<10){plamove(0);}
		else{if(p<-15){plamove(1);}
		else{if(p>15){plamove(2);}
		else{if(q<-15){plamove(3);}
		else{if(q>15){plamove(4);}}}}}
	}
	
	private function plamove(direction:uint):void{
		switch(direction){
			case 0:center();break;
			case 1:plate.x-=4*k;break;
			case 2:plate.x+=4*k;break;
			case 3:plate.y-=4*k;break;
			case 4:plate.y+=4*k;break;
		}
	}
	
	private function center():void{
		var w:uint=plate.width/2;
		var h:uint=plate.height/2;
		plate.x=465/2-w;
		plate.y=465/2-h;
	}
	public function show(scale:uint):void{
		k=scale;
		var dum:BitmapData=dna.bmp();
		var size:Array=dna.size;
		var w:uint=dna.size[0]*k;
		var h:uint=dna.size[1]*k;
		var m : Matrix = new Matrix();
		m.identity();
		m.translate(0,0);
		m.scale(k,k);
		plate.graphics.clear();
		plate.graphics.beginBitmapFill(dum,m);
		plate.graphics.drawRect(0,0,w,h);
		plate.graphics.endFill();
		
		plate.graphics.lineStyle(0,0xaaaaaa);
		plate.graphics.drawRect(-2,-2,w+3,h+3);
		plate.graphics.lineStyle(0,0xeeeeee);
		plate.graphics.drawRect(-1,-1,size[0]*k+1,size[1]*k+1);
	}
	
	private function inject(p:uint,q:uint,n:uint):void{
		if(n<dna.palette.length){
			if(dna.rows[q].length<p+1){dna.rows[q].length=p+1;}
			dna.rows[q][p]=n;
		}
	}
	
	private function initpbox():void{
		initink();
		repbox();
		cur.graphics.lineStyle(0);
		cur.graphics.drawRect(-2,-2,23,23);
		
		pbox.x=16;pbox.y=120;
		
		addChild(pbox);
		pbox.addChild(cur);
		
		pbox.addEventListener(MouseEvent.MOUSE_DOWN, onPboxClick);
	}
	private function repbox():void{
		if(inkready){removeChild(ink);inkready=false;}
		pbox.graphics.clear();
		cur.y=0;cur.x=0;icolor=0;
		var long:uint=dna.palette.length;
		for (var i:uint=0;i<long+1;i++){
			sbox(i);
		}
	}
	
	private function sbox(n:uint):void{
		var d:uint=Math.floor(n/10);
		var u:uint=n%10;
		var bmp:BitmapData;
		pbox.graphics.beginFill(0xcccccc);
		pbox.graphics.drawRoundRect(d*25,u*25,20,20,10);
		if(n<dna.palette.length){
			bmp=new BitmapData(10,10,true,dna.palette[n]);
			pbox.graphics.beginBitmapFill(bmp);
			pbox.graphics.drawRect(d*25+5,u*25+5,10,10);
		}
		else{
			pbox.graphics.beginBitmapFill(dmap([[25,25],[0,4278190080],[0],[0],[0],[0,0,0,0,0,0,0,0,0,1,1],[0,0,0,0,0,0,0,0,0,1,1],[0,0,0,0,0,0,0,1,1,1,1,1,1],[0,0,0,0,0,0,0,1,1,1,1,1,1],[0,0,0,0,0,0,0,0,0,1,1],[0,0,0,0,0,0,0,0,0,1,1],[0],[0],[0,1,1,1,0,1,1,1,0,0,1,2,2,0,1,2,2,1,2],[0,0,0,1,0,0,0,1,0,0,1,0,2,0,2,0,1,1,1],[0,1,1,1,0,1,1,1,0,0,1,1,1,0,1,0,0,1],[0,0,0,1,0,1,0,0,0,0,1,0,1,0,1,0,0,1],[0,1,1,1,0,1,1,1,0,2,1,1,1,0,1,0,0,1],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0]]));
			pbox.graphics.drawRect(d*25,u*25,20,25);
		}
		pbox.graphics.endFill();
	}
	private function onPboxClick(e:MouseEvent):void{
		var u:uint=(pbox.mouseY)/25;
		var d:uint=(pbox.mouseX)/25;
		var n:uint=d*10+u;
		if(inkready){inkout();}
		else{
			if(icolor==n||n>dna.palette.length-1){
				inkent(n);
			}
		}
			icolor=n;
			cur.x=d*25;cur.y=u*25;
	}
	private function initink():void{
		ink.graphics.beginFill(0xcccccc);
		ink.graphics.drawRoundRect(85,0,20,20,10);
		ink.graphics.endFill();
		t3.width=80;
		t3.height=20;
		t3.maxChars=10;
		t3.restrict="0-9,a-f,A-F,x,X";
		t3.borderColor=0xcccccc;
		t3.border=true;
		t3.background=true;
		t3.type="input";
		ink.addChild(t3);
		ink.addEventListener(MouseEvent.MOUSE_DOWN, onInkClick);
	}
	private function inkent(n:uint):void{
		var u:uint=n%10;
		var d:uint=(n-u)/10;
		t3.text="0xFF000000";
		inkready=true;
		ink.x=pbox.x+(d+1)*25;
		ink.y=pbox.y+u*25;
		addChild(ink);
	}
	private function inkout():void{
		if(inkready){
			inkready=false;
			removeChild(ink);
		}
	}
	private function onInkClick(e:MouseEvent):void{
		var w:uint=(ink.mouseX);
		var rec:uint=icolor;
		if(w>85){
			inkout();
			var n:uint=uint(t3.text);
			if(icolor<dna.palette.length){dna.palette[icolor]=n;show(k);}
			else{dna.palette.push(n);}
			repbox();
			icolor=rec;
			cur.y=rec%10*25;
			cur.x=(rec-rec%10)/10*25;
		}
	}
	private function rr(tgt:Sprite,p:uint,q:uint,r:uint):void{
		tgt.graphics.beginFill(0xccccccc);
		tgt.graphics.drawRoundRect(0,0,p,q,r);
		tgt.graphics.endFill();
	}
}


//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
import flash.display.BitmapData;

function dmap(dat:Array):BitmapData{
	var dna:Dna= new Dna(dat);
	return dna.bmp();
}

class Dna{
	public var size:Array;
	public var palette:Array;
	public var rows:Vector.<Vector.<uint>>;
	
	public function Dna(dat:Array){
		size=dat.shift();
		palette=dat.shift();
		rows=zeromap(size[1]);
		for(var i:uint=0;i<dat.length;i++){
			rows[i]=Vector.<uint>(dat[i]);
		}
		dat.unshift(size,palette);
	}
	
	private function zeromap(h:uint):Vector.<Vector.<uint>>{
		var rows:Vector.<Vector.<uint>>=new Vector.<Vector.<uint>>(h);
		for(var i:uint=0; i<h;i++){
			rows[i]=new Vector.<uint>(1);
		}
		return rows;
	}
	public function bmp():BitmapData{
		var dum:BitmapData=new BitmapData(size[0],size[1],true,palette[0]);
		dotplot(dum);
		return dum;
	}
	private function dotplot(canvas:BitmapData):void{
		var h:uint=rows.length;
		
		canvas.lock();
		for (var i:uint=0;i<h;i++){
			var w:uint=rows[i].length;
			for (var j:uint=0;j<w;j++){
				var color:int=rows[i][j];
				if(color>palette.length){color=0;}
				canvas.setPixel32(j,i,palette[color]);
			}
		}
		canvas.unlock();
	}
	
	public function code():String{
		var rowstr:String=rows[0].toString();
		for(var i:uint=1;i<rows.length;i++){
			rowstr+="],["+rows[i];
		}
		rowstr+="]]";
		var headstr:String="[["+size+"],["+palette+"],[";
		return headstr.concat(rowstr);
	}
	private function optim():void{
		rows.reverse();
		var h:uint=rows.length;
		for(var i:uint=0;i<h;i++){
			rows[i]
		}
		
	}
	private function hex(hdn:uint, nmode:uint=8) :String{
	var str:String="";	var cifra:uint;
	var L:uint=(0<nmode&&nmode<9)? nmode : 8;
	for (var i:uint=0; i<L; i++){
		cifra= 0xF & (hdn >>> 4*i);
		cifra+=(cifra>9)?55:48;	//48="0",57="9",65="A";
		str=String.fromCharCode(cifra)+str;}
	return "0x"+str;
	}
	
}

//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

/////  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);
            
        }
}