Nicolas Cannasse il y a 19 ans
Parent
commit
3a4d3851c4
2 fichiers modifiés avec 84 ajouts et 0 suppressions
  1. 51 0
      std/flash9/Boot.hx
  2. 33 0
      std/flash9/Lib.hx

+ 51 - 0
std/flash9/Boot.hx

@@ -0,0 +1,51 @@
+package flash;
+
+class Boot extends flash.display.MovieClip {
+
+	static var init;
+	static var tf;
+	static var lines : Array<String>;
+
+	function new() {
+		super();
+		lines = new Array();
+		flash.Lib.current = this;
+		init();
+	}
+
+	static function __instanceof( v : Dynamic, t : Dynamic ) {
+		try {
+			return untyped __is__(v,t);
+		} catch( e : Dynamic ) {
+			return false;
+		}
+	}
+
+	static function __clear_trace() {
+		flash.Lib.current.removeChild(tf);
+		tf = null;
+		lines = new Array();
+	}
+
+	static function __trace( v : Dynamic, pos : haxe.PosInfos ) {
+		var mc = flash.Lib.current;
+		if( tf == null ) {
+			tf = new flash.text.TextField();
+			tf.selectable = false;
+			tf.width = mc.stage.stageWidth;
+			tf.autoSize = flash.text.TextFieldAutoSize.LEFT;
+		}
+		mc.addChild(tf); // on top
+		lines = lines.concat((pos.fileName+":"+pos.lineNumber+": "+__string_rec(v,"")).split("\n"));
+		tf.text = lines.join("\n");
+		while( tf.height > mc.stage.stageHeight ) {
+			lines.shift();
+			tf.text = lines.join("\n");
+		}
+	}
+
+	static function __string_rec( v : Dynamic, str : String ) {
+		return v + "";
+	}
+
+}

+ 33 - 0
std/flash9/Lib.hx

@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2005, The haXe Project Contributors
+ * All rights reserved.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE HAXE PROJECT CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE HAXE PROJECT CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ */
+package flash;
+
+class Lib {
+
+	public static var current : flash.display.MovieClip;
+
+}
+
+