Przeglądaj źródła

added desktopConnect.

Nicolas Cannasse 19 lat temu
rodzic
commit
b096064821
1 zmienionych plików z 13 dodań i 1 usunięć
  1. 13 1
      std/haxe/remoting/Connection.hx

+ 13 - 1
std/haxe/remoting/Connection.hx

@@ -48,7 +48,11 @@ class Connection implements Dynamic<Connection> {
 		var s = new haxe.Serializer();
 		s.serialize(params);
 		var params = s.toString().split("\\").join("\\\\");
-		var s = flash.external.ExternalInterface.call("haxe.remoting.Connection.doCall",path,f,params);
+		var s;
+		if( __data )
+			s = flash.external.ExternalInterface.call(path+"."+f,params);
+		else
+			s = flash.external.ExternalInterface.call("haxe.remoting.Connection.doCall",path,f,params);
 		if( s == null )
 			throw "Failed to call JS method "+__path.join(".");
 		return new haxe.Unserializer(s).unserialize();
@@ -121,6 +125,14 @@ class Connection implements Dynamic<Connection> {
 		return new Connection(null,[]);
 	}
 
+	public static function desktopConnect() : Connection {
+		if( !flash.external.ExternalInterface.available )
+			throw "External Interface not available";
+		if( flash.external.ExternalInterface.call(":desktop",":available") != "yes" )
+			throw "Could not connect to the Desktop";
+		return new Connection(true,[]);
+	}
+
 	#else js
 
 	static function jsRemoting() {