- fprintf(stderr, "swf_Relocate: Mapping id (%d) never encountered before in %s\n", id,
- swf_TagGetName(tag));
+ if(!id && bitmap[id]) {
+ /* id 0 is only used in SWF versions >=9. It's the ID of
+ the main timeline. It's used in e.g. SYMBOLTAG tags, but
+ never defined, so if we're asked to reallocate it, we have
+ to allocate an ID for it on the fly. */
+ int newid;
+ NEW_ID(newid);
+ bitmap[newid] = 1;
+ slaveids[id] = newid;
+ id = newid;
+ } else if(!bitmap[id]) {
+ /* well- we don't know this id, but it's not reserved anyway, so just
+ leave it alone */
+ } else {
+ /* this actually happens with files created with Flash CS4 and never.
+ Apparently e.g. DefineButton tags are able to use forward declarations of objects. */
+ fprintf(stderr, "warning: Mapping id (%d) never encountered before in %s\n", id,
+ swf_TagGetName(tag));
+ int newid;
+ NEW_ID(newid);
+ id = slaveids[id] = newid;
+ ok = 0;
+ }