Browse Source

auto setup trace text color / glow depending on stage background color (10.2+)

Nicolas Cannasse 13 years ago
parent
commit
926fe3d950
1 changed files with 12 additions and 1 deletions
  1. 12 1
      std/flash/Boot.hx

+ 12 - 1
std/flash/Boot.hx

@@ -110,13 +110,24 @@ class Boot extends flash.display.MovieClip {
 	}
 	}
 
 
 	public static function __set_trace_color(rgb) {
 	public static function __set_trace_color(rgb) {
-		getTrace().textColor = rgb;
+		var tf = getTrace();
+		tf.textColor = rgb;
+		tf.filters = [];
 	}
 	}
 
 
 	public static function getTrace() {
 	public static function getTrace() {
 		var mc = flash.Lib.current;
 		var mc = flash.Lib.current;
 		if( tf == null ) {
 		if( tf == null ) {
 			tf = new flash.text.TextField();
 			tf = new flash.text.TextField();
+			#if flash10_2
+			var color = 0xFFFFFF, glow = 0;
+			if( mc.stage != null ) {
+				glow = mc.stage.color;
+				color = 0xFFFFFF - glow;
+			}
+			tf.textColor = color;
+			tf.filters = [new flash.filters.GlowFilter(glow, 1, 2, 2, 20)];
+			#end
 			var format = tf.getTextFormat();
 			var format = tf.getTextFormat();
 			format.font = "_sans";
 			format.font = "_sans";
 			tf.defaultTextFormat = format;
 			tf.defaultTextFormat = format;