If you are looking for the decompiler itself, visit https://github.com/jindrapetrik/jpexs-decompiler
NEW : We have got a new blog where we post some interesting SWF internals info.

#1689 Unable to add a new BitmapAsset.
Author:
Lassebq

Date created:
Type: bug
Visibility: Everybody
Assigned to:
Labels: Tag position
State: closed 

> What steps will reproduce the problem?
- Added DefineBitsLossless2Tag
- Imported image into it
- Changed SymbolClass tag to include the name (Img_VineSingle) for this asset
- Once I add a new class extending from BitmapAsset and call it with my asset name, the
game will not launch and have a black screen instead.
I needed a new BitmapAsset for use in the script, but it doesn't work.
14.4.0 - stable | Windows 7 64-bit
I was trying to mod the game called Tower of Heaven, here's edited swf with broken
Img_VineSingle class.

I checked this flash and I see the internal tag structure is wrong (best can be seen in
hex dump mode). In particular, DoABC2(Img_VineSingle)(TAG) is at the wrong place. Getting
a decompiler to figure the correct placement of some tags can be difficult, given the wide
range of possibilities in the flash format, so idk if this can be fixed.
Anyway, it can be done in a hex editor, and I've done it for you (file attached). I also
moved DefineBitsLossless2 (253) (TAG) to its correct place, though flash was working fine
before that too.
This gives me an idea for a ...
FEATURE: The tags to the left side in hex dump mode should be draggable so we can
rearrange them, this would eliminate the need for external hex editor in this case.

Thanks for the help!
Although, I'd still like to know in details how to fix it myself (in case I want to add
more BitmapAssets).
I assume any hex viwer/editor would work for that (I have HxD)
Where exactly should this tag be moved? Do you just cut/paste chunk of bytes in between
another two tags?
Also, the feature suggestion you mentioned would be a great addition to the decompiler.
"Do you just cut/paste chunk of bytes in between
another two tags?" Yes, this is exactly what you do, flash tags (top level tags at least)
are self-contained and do not depend on other tags, so you can move them around. FFDEC's
hex view helps you to see start and end offset of the tags, then you cut-paste in a hex
editor that memory block. The first thing to do however is decompress flash if needed: if
header signature is CWS, edit header's "compression" field to "uncompressed" and save the
file.
Some general rules about tags are:
- all tags that are defining a frame must exist before the corresponding ShowFrame tag
- if a script is referencing some resource, that resource must be before the script, i.e.
DefineBitsLossless must be before DoABC. Generally this means that the last two tags
before ShowFrame are DoABC and SymbolClass. This rule was broken in your flash.
- if a tag is referencing some resource, then the resource must be before the tag.
Example: we have a sprite that contains a shape, and the shape contains an image: then
image tag must be first, shape tag is next, sprite tag is last (they don't need to be
immediately one after another).
I'm sorry if some of that info is wrong, I learned it all myself during the years of
decompiling flashes.
Alright thanks, all of that info seems to be accurate and I was able to fix crashing in
two games just by cutting and pasting tags in hex view. Another game was adding scripts in
the right place without casuing it to crash, the image data was in the wrong area.
Hopefully easy way to drag tags in decompiler will be a feature.
In FFDec 16.0.0, you can move tag to proper position with right click context menu -> move
tag.
State: new→upgraded
Many thanks. Tag list view is my favorite now.
State: upgraded→closed