Ver código fonte

added __trace and __clear_trace

Nicolas Cannasse 20 anos atrás
pai
commit
a7d674fc87
1 arquivos alterados com 25 adições e 0 exclusões
  1. 25 0
      std/flash/Boot.hx

+ 25 - 0
std/flash/Boot.hx

@@ -75,6 +75,31 @@ class Boot {
 		}
 	}
 
+	private static function __trace(v) {
+		untyped {
+			var tf = _root.__trace_txt;
+			if( tf == null ) {
+				_root.createTextField("__trace_txt",1048500,0,0,Stage.width,Stage.height);
+				tf = _root.__trace_txt;
+				tf.selectable = false;
+				_root.__trace_lines = new Array<String>();
+			}
+			var lines = _root.__trace_lines.concat(__string_rec(v,"").split("\n"));
+			_root.__trace_lines = lines;
+			var nlines = Stage.height / 16;
+			if( lines.length > nlines )
+				lines.splice(0,lines.length-nlines);
+			tf.text = lines.join("\n");
+		}
+	}
+
+	private static function __clear_trace() {
+		untyped {
+			_root.__trace_txt.removeTextField();
+			_root.__trace_lines = null;
+		}
+	}
+
 	private static function __init(current) {
 		untyped {
 			var obj = _global["Object"];