00:00
00:00
Newgrounds Background Image Theme

kazukino55 just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

[AS3] weird ByteArray error

960 Views | 2 Replies
New Topic Respond to this Topic

[AS3] weird ByteArray error 2015-01-07 21:13:02


sorry for asking so many questions lately you guys :<
I'm making a data formatter for the game i'm making. here's how i'm going about it:

character/stages need 1 sprite sheet and 1 metadata JSON

- extract bitmapData from image and save into a variable
- load and encrypt JSON string using a combination of xor and base64 encryption (decrypts fine)
- make object and put them both into it -> { sheet: [bitmapData], meta: [cryptString] }
- write that all into a ByteArray and compress using byteArray.compress();
- write byteArray into a file and save it

it's fairly straightforward i think, but when i try to decompress one of those files (using byteArray.uncompress(); of course), i get this error in FlashDevelop:

[Fault] exception, information=Error: Error #2058: There was an error decompressing the data.

BUT, right before that, it traces the data correctly!

loaded ucd name: dummy
loaded ucd json: {"stats":{},"hitboxData":{},"animationData":{},"name":"dummy"}

is this a bug?? do i have to worry about it messing something up? if i end up doing expansion characters, i want to be able to make this data formatter a public tool so people can work on their own characters or stages, like MUGEN, but easier.

once again, i'd really appreciate any help you guys could give :>

Response to [AS3] weird ByteArray error 2015-01-07 21:52:12


Try specifying the compression algorithm when performing those operations.

Trace out the byteArray and check if it's the same before writing into the file, and after reading it from the file.

If it's already uncompressing correctly but showing the exception message, it could be coming from another source.


Check out the Flash RPG I made in 2024. It takes about 25 minutes to complete.

BBS Signature

Response to [AS3] weird ByteArray error 2015-01-07 22:32:56


i did everything you said and i found out what it was! thanks man
for some odd reason, the loader i was using ran the onComplete function twice...at least it looks like it. i didn't run it twice or anything.
still trying to figure that out, but for now, i just made a resetLoader() method where it closes the loader and nullifies all of it's variables. worked like a charm.

thanks again for the help :>