Is there any SWF library that can just edit one swf tag?
I'm working on a project and i need to open a swf file, change contents of a swf tag without touching other tags
I've tried 开发者_如何学C"SwfDotNet library" but it does not output the unknown tags. For example if it encounters a "EXPORTASSETS" tag it does not write it to the output SWF because the library is old and supports up to swf version 7 and the tag is new.
Are there any libraries with this capability?
This can be done with SWFWire using the AsyncSWFReaderFiltered class. For example if you wanted to read only ShowFrame tags:
var reader:AsyncSWFReaderFiltered = new AsyncSWFReaderFiltered();
reader.includedTags[1] = true;
reader.addEventListener(AsyncSWFReaderEvent.TAG_READ, function(ev:AsyncSWFReaderEvent):void
{
trace('Done reading tag #'+ev.result.swf.tags.length);
});
reader.read();
All other tags will appear as UnknownTag
, which are just containers for a ByteArray
.
I have solution for as3(flex) that can work in runtime:
- Load needed swf as bytearray via URLLoader,
- Parse swf via https://github.com/claus/as3swf util.
- Made your changes to tags.
- Generate new bytearray and load it via generic SWFLoader. I used that way to change swf version in runtime.
Also take a look at this tools for swf content manipulations:
- http://code.google.com/p/apparat/
- http://swfmill.org/ - you can convert your swf to xml, adjust and convert back to swf.
精彩评论