开发者

Is there any SWF library that can just edit one swf tag?

开发者 https://www.devze.com 2023-03-30 07:21 出处:网络
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'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:

  1. Load needed swf as bytearray via URLLoader,
  2. Parse swf via https://github.com/claus/as3swf util.
  3. Made your changes to tags.
  4. 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.
0

精彩评论

暂无评论...
验证码 换一张
取 消