1. localconnection
Flash data transmission between, naturally think of localconnection and other methods.
However, in practice, it is not that easy to upload data like an image. First, localconnection can only transmit 40 k of data at a time after sending, And it is encoded by AMF. That is to say, you can only have 30 + k space at most. To address this restriction, we first think of splitting n copies for sending.
VaR Size: Int = 30*1024;
VaR Count: Int = A. Length/size + 1;
VaR Localconnection: Localconnection =
New Localconnection ();
For (
VaR I: Int = 0; I <count; I ++) {
VaR Temp: bytearray =
New Bytearray (); Temp. writebytes (A, I * size, math. Min (size, A. Length-I * size )); Localconnection. Send (
"Photoshoweditor" ,
"Showbitmapdata" , Temp ); } However, it turns out that this is a very problematic practice. For example, in the test, if K of PNG data is to be transmitted, 9 parts are split for data transfer. The results are frustrating... It takes 4s to complete the transmission. Therefore, it is concluded that localconnection is not suitable for big data transmission. A transit must be found. 2. localconnection + export dobject Someone imagined using mongodobject as a transit zone, and using localconnection to notify the recipient to accept it. However, according to incomplete statistics on the QQ Show client, 10% of users intentionally or unintentionally close mongodobject. Obviously, this method is not completely reliable. 3. base64 encoding and passing through JS The k png image is encoded to about K, and parameters are passed between flash and js to fully accommodate this size of string. However, if the cross-IFRAME is passed, it may be a little complicated. But at least this solution is the most reliable Finally, except for the above three schemes, the most reliable scheme may not be directly transmitted locally. If you can use the server, upload the image first and then display it on the other side, maybe the problem is completely gone.