ByteArray Type Coercion failure when reading from

2019-05-30 17:20发布

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条回答
smile是对你的礼貌
2楼-- · 2019-05-30 17:58

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.

查看更多
登录 后发表回答