我正在 Flash 构建器中使用 actionscript 3.0 构建一个应用程序。这是一个后续问题这个问题.
我需要将字节数组上传到我的服务器,但是我使用的函数将位图数据转换为ByteArray
速度超级慢,慢到我的移动设备都卡住了。我的代码如下:
var jpgenc:JPEGEncoder = new JPEGEncoder(50);
trace('encode');
//encode the bitmapdata object and keep the encoded ByteArray
var imgByteArray:ByteArray = jpgenc.encode(bitmap);
temp2 = File.applicationStorageDirectory.resolvePath("snapshot.jpg");
var fs:FileStream = new FileStream();
trace('fs');
try{
//open file in write mode
fs.open(temp2,FileMode.WRITE);
//write bytes from the byte array
fs.writeBytes(imgByteArray);
//close the file
fs.close();
}catch(e:Error){
有没有其他方法可以将其转换为byteArray
?有没有更好的办法?
尝试使用血腥库:http://www.blooddy.by。但我没有在移动设备上进行测试。评论一下你是否会成功。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)