case2000
case2000

Reputation: 178

Flash Player 11 vs. 10 ByteArray error #2030 with PixelBender

I'm trying to use the 3d projection via PixelBender part of this demo by unitzeroone, which is pretty sweet by itself, even without the alchemy pixel-drawing. The problem is it doesn't work when viewed in Flash Player 11+. The SWFs preview fine when published from Flash CS4, or CS5, but not CS5.5. When the SWF is opened locally our setups seem to use the FP10 debug player, which works great, but if you drag the same SWF into a browser (chrome/FF) with the latest Flash Player installed (11+) it throws the following error on a ByteArray.readFloat():

Error #2030: End of file was encountered.

...Thrown during a ByteArray.readFLoat()... the very first time it's called. Right after I've done a loop of ByteArray.writeFloats, so I know the ByteArray is chock full of data at that point. Again - this code works perfectly on FP10, but fails on FP11. I've tried catching the error, and it traces the error as you'd expect, but I'm still stuck on how to make this ByteArray code work in Flash Player 11.

I've Googled this as best I can, and found lots of references to #2030 errors and ByteArrays, but none that seem to distinguish so clearly between FP10 and FP11. Here's the SWF.

Any ideas? Is there a problem with the write() or read() functions for ByteArrays that's only present in FP11? Is there a workaround?

Thanks!

-Case

Upvotes: 0

Views: 1497

Answers (1)

case2000
case2000

Reputation: 178

I figured it out, though I don't fully understand what the problem was. Flash player 11 seems to require that I reset the position on my PixelBender output ByteArray to 0 right after I run my ShaderJob.

var job:ShaderJob = new ShaderJob(shader, MyByteArray, 1024, 1);
job.start(true);
MyByteArray.position = 0

FP10 didn't require this - I guess it was resetting the position automatically after the ShaderJob? It must be down to a subtly different implementation of PixelBender across the 2 flash player versions?

Upvotes: 2

Related Questions