Browse Source

fixes compilation issues with js

Nicolas Cannasse 11 years ago
parent
commit
968bffc6fc
2 changed files with 14 additions and 9 deletions
  1. 1 1
      all.hxml
  2. 13 8
      hxd/ByteConversions.hx

+ 1 - 1
all.hxml

@@ -11,4 +11,4 @@
 --next
 --next
 
 
 -swf heaps.swf
 -swf heaps.swf
--swf-version 11.2
+-swf-version 15

+ 13 - 8
hxd/ByteConversions.hx

@@ -7,6 +7,8 @@ import haxe.io.Bytes;
  */
  */
 class ByteConversions{
 class ByteConversions{
 
 
+#if (flash || openfl)
+
 	public static function byteArrayToBytes( v: flash.utils.ByteArray ) : haxe.io.Bytes {
 	public static function byteArrayToBytes( v: flash.utils.ByteArray ) : haxe.io.Bytes {
 		return
 		return
 		#if flash
 		#if flash
@@ -19,18 +21,12 @@ class ByteConversions{
 			b;
 			b;
 		};
 		};
 		#elseif (openfl)
 		#elseif (openfl)
-		v; 
+		v;
 		#else
 		#else
 		throw "unsupported on this platform";
 		throw "unsupported on this platform";
 		#end
 		#end
 	}
 	}
-	
-	#if js
-	public static function arrayBufferToBytes( v : js.html.ArrayBuffer ) : haxe.io.Bytes{
-		return byteArrayToBytes(flash.utils.ByteArray.nmeOfBuffer(v));
-	}
-	#end
-		
+
 	public static function bytesToByteArray( v: haxe.io.Bytes ) :  flash.utils.ByteArray {
 	public static function bytesToByteArray( v: haxe.io.Bytes ) :  flash.utils.ByteArray {
 		#if flash
 		#if flash
 		return v.getData();
 		return v.getData();
@@ -40,4 +36,13 @@ class ByteConversions{
 		throw "unsupported on this platform";
 		throw "unsupported on this platform";
 		#end
 		#end
 	}
 	}
+
+	#if js
+	public static function arrayBufferToBytes( v : js.html.ArrayBuffer ) : haxe.io.Bytes{
+		return byteArrayToBytes(flash.utils.ByteArray.nmeOfBuffer(v));
+	}
+	#end
+
+#end
+
 }
 }