Flash Air ActionScript3 二进制数据写入文件

package
{
	import flash.display.Sprite;
	import flash.events.NetStatusEvent;
	import flash.filesystem.File;
	import flash.filesystem.FileMode;
	import flash.filesystem.FileStream;
	import flash.media.Video;
	import flash.net.FileReference;
	import flash.net.NetConnection;
	import flash.net.NetStream;
	import flash.utils.ByteArray;
	
	public class TestAir extends Sprite
	{
		private var f:File;
		private var fs:FileStream;
		
		public function TestAir()
		{	
			f = File.desktopDirectory.resolvePath("test.flv");
			fs = new FileStream();
			
			fs.open(f, FileMode.APPEND);
			
			var data:ByteArray = new ByteArray();
			data.writeByte(1);
			data.writeByte(2);
			data.writeByte(3);
			
			fs.writeBytes(data);
			
			fs.close();
		}
	}
}

你可能感兴趣的:(actionscript)