ByteArray Type Coercion failure when reading from Javascript ExternalInterface call

不羁的心 提交于 2019-12-08 08:12:49

问题


I am reading in a ByteArray object from an ExternalInterface call which is obtaining the ByteArray from another SWF. The reason for the Javascript conduit is because the ByteArray data exceeds the 40k limit of the LocalConnection class.

I'm getting the following error:

TypeError: Error #1034: Type Coercion failed: cannot convert Object@d6f48e1 to flash.utils.ByteArray.

with this line of code:

swfBytes = ExternalInterface.call("getBytes", cacheIdx);

swfBytes is an initialized ByteArray object. I'm confident my call to getBytes() is returning a ByteArray object because if I run the following line of code, I get the number of bytes being passed.

ExternalInterface.call("getBytes", cacheIdx).bytesAvailable;

Any help is greatly appreciated.


回答1:


Thanks! Splitting the data into 40k chunks worked well. Now I have another issue, which is the inability to properly close and reuse the connection. Another answered question suggested using a unique connection string for each connection.



来源:https://stackoverflow.com/questions/23768581/bytearray-type-coercion-failure-when-reading-from-javascript-externalinterface-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!