Browse Source

flash9 support.

Nicolas Cannasse 19 years ago
parent
commit
9f9879a8ab
1 changed files with 8 additions and 0 deletions
  1. 8 0
      std/haxe/remoting/SocketConnection.hx

+ 8 - 0
std/haxe/remoting/SocketConnection.hx

@@ -214,6 +214,13 @@ class SocketConnection extends AsyncConnection {
 	public static function socketConnect( s : XMLSocket ) {
 	public static function socketConnect( s : XMLSocket ) {
 		var sc = new SocketConnection(s,[]);
 		var sc = new SocketConnection(s,[]);
 		sc.__funs = new List();
 		sc.__funs = new List();
+		#if flash9
+		s.addEventListener(flash.events.DataEvent.DATA, function(e : flash.events.DataEvent) {
+			var e = processMessage(sc,e.data.substr(2,e.data.length-2));
+			if( e != null )
+				throw e.exc;
+		});
+		#else true
 		// we can't deliver directly the message
 		// we can't deliver directly the message
 		// since it might trigger a blocking action on JS side
 		// since it might trigger a blocking action on JS side
 		// and in that case this will trigger a Flash bug
 		// and in that case this will trigger a Flash bug
@@ -229,6 +236,7 @@ class SocketConnection extends AsyncConnection {
 					throw e.exc;
 					throw e.exc;
 			};
 			};
 		};
 		};
+		#end
 		return sc;
 		return sc;
 	}
 	}