我們一直在爲此付出沉重的代價,並希望得到一些幫助!PNG偶爾會丟失從閃存到服務器的數據
我們的用戶在Flash中創建TIFS,並通過HTTP POST以Base64發佈的圖像數據,與接收它的ASPX服務器:
byte[] bytes = Convert.FromBase64String(Request.Form["ImgData"] );
我們發現這個方法的作品,但在20-30一個或者如此情況,服務器收到的數據量與客戶聲稱發送的數據量不同。 ASPX代碼:
dataLengthSentFromClient = Request.Form["dataLengthFromClient"].ToString();
<>
ReceivedBytesLength=Request.Form["ImgData"].Length.ToString();
但其他24次它似乎工作正常。有任何想法嗎?我們是不是應該以這種方式將數據從Flash傳遞到服務器?
(這是客戶端的AS代碼) var image:BitmapData;
if (toTrim) {
tempBitmapData=new BitmapData(workingSrc.width,workingSrc.height,true,0x00000000);
tempBitmapData.draw(workingSrc);
var tempBitmap:Bitmap=new Bitmap(tempBitmapData,PixelSnapping.ALWAYS,true);
bounds=tempBitmapData.getColorBoundsRect(0xFF000000,0x00000000,false);
var letterMatrix:Matrix=new Matrix(1,0,0,1,- bounds.x,- bounds.y);
tempBitmap.transform.matrix=letterMatrix;
image=new BitmapData(bounds.width,bounds.height,true,0x00000000);
image.draw(tempBitmap,letterMatrix);
} else {
image=new BitmapData(workingSrc.width,workingSrc.height,true,0x00000000);
image.draw(workingSrc,letterMatrix);
}
var bytes:ByteArray=PNGEncoder.encode(image);
var base64Bytes:String=Base64.encodeByteArray(bytes);
var vars:URLVariables = new URLVariables();
vars.activityID=activityID;
vars.imgData=base64Bytes;
vars.dataLengthFromSarah=vars.imgData.length;
vars.activityLocation=activityLoc;
vars.op="writePNG";
if (fileName!=null) {
vars.filename=fileName;
}
// Save info about the variables passed in case we need to dump error data
dispatchEvent(new DumpPrepEvent(vars.toString()));
var url:URLRequest=new URLRequest(INTERFACE);
url.data=vars;
url.method=URLRequestMethod.POST;
這是很好的知道,以節省流量,但我不知道它是否導致偶爾的轉移失敗。我們使用的軟件包: 和 和com.hurlant.util.Base64; – user1512545 2012-07-13 04:02:14
緩存問題很有趣。我會研究這一點。你推薦一種更可靠的方式從Flash傳輸圖像數據?如果有幫助,我很樂意改變它! – user1512545 2012-07-13 20:01:23