瀏覽代碼

added @:file support for flash

Nicolas Cannasse 13 年之前
父節點
當前提交
c731f34c6f
共有 2 個文件被更改,包括 7 次插入0 次删除
  1. 1 0
      doc/CHANGES.txt
  2. 6 0
      genswf.ml

+ 1 - 0
doc/CHANGES.txt

@@ -30,6 +30,7 @@
 	all : allow \uXXXX in regexp (although not supported everywhere)
 	js : make difference between values and statements expressions in JSGenApi
 	js : added source mapping with -debug (replace previous stack emulation)
+	flash : added @:file("a.dat") class File extends flash.utils.ByteArray
 
 2011-09-25: 2.08
 	js : added js.JQuery

+ 6 - 0
genswf.ml

@@ -836,6 +836,12 @@ let build_swf9 com file swc =
 					incr cid;
 					classes := { f9_cid = Some !cid; f9_classname = s_type_path c.cl_path } :: !classes;
 					tag (TBitsJPEG2 { bd_id = !cid; bd_data = data; bd_table = None; bd_alpha = None; bd_deblock = None }) :: loop l
+				| (":file",[EConst (String file),p],_) :: l ->
+					let file = try Common.find_file com file with Not_found -> file in
+					let data = (try Std.input_file ~bin:true file with _  -> error "File not found" p) in
+					incr cid;
+					classes := { f9_cid = Some !cid; f9_classname = s_type_path c.cl_path } :: !classes;
+					tag (TBinaryData (!cid,data)) :: loop l
 				| _ :: l -> loop l
 			in
 			loop c.cl_meta