Wow! it's been about 2 1/2 weeks since I last posted, and it seems like forever. In the meantime, I've upgraded my machines to Windows Vista RC2, and I'm not looking back. I had to do some work on my wife's computer the other day, and she's still running Windows XP. Well, not for long. :) Anyway...
Ever since my post about Converting Flash Shapes to WPF, I've been asked about the BitReader class that I mentioned. That class has since been replaced by a much more specialized class called SWFReader. As you can probably tell by the name, it's job is to make it easier to read Adobe/Macromedia Flash (SWF) files and their associated data types. If you're unfamiliar with the contents of a SWF file, you should check out A Concise Guide to the SWF File Format and Alexis' SWF Reference. Both are excellent resources.
To get going, first download my C# sample code: FlashTools.zip (10KB). This Visual Studio 2005 solution contains two projects:
It's important to note that most modern Flash files use ZLIB compression (explained in RFCs 1950, 1951, and 1952). You could certainly implement your own "inflate" logic, but it's already been done by a number of folks. I chose to use the fully managed SharpZipLib. You'll need to download the assembly and add a reference to it from the FlashTools project to successfully compile my sample code.
To examine the contents of a SWF file in detail, the Dump Flash Decompiler is an invaluable tool. SWF Tools is another good one to check out (especially SWFDump). Both of these are useful for validating the data that you're reading from the SWF file.
Last, this is sample code, so swim at your own risk. There's no error checking, unit tests, performance optimizations, or guarantees. If you're going to build a more robust solution, this code will only give you enough guidance to get going. If you have any questions, feel free to contact me directly. Otherwise, party on!
Please can you help me regarding the update of the definetext2 content.I can extract the text but cannot figure out how to update the text inside the tag.
Can you pls explain how to read metadata from flash files as it is being streamed to the browser?
This is just what i need to start on my project ^_-
thanks for sharing
After searching high and low for something that could read height/width from a swf I found this.
Thanks for this, it was a great help!
Yes this article is helpful to read the SFW Header.Can you please suggest how to read all the tags and there corresponding value and extract the informations embebded in that.
Thanks in advance for your help
Hi! thanks for that library. I tried several libraries to determine an swf size and all others return wrong values. But this library returns swf sizes well. Thanks!