The local transmission of big data, image data, and localconnection in Flash exceeds the size limit. bitmapdata is exceeded.

Source: Internet
Author: User
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.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.