Macromedia's Improved Swf Openness
While working on our .NET port of SwfSource (a .NET library for working with flash content and creating flash enabled applications), I have been extremely impressed by Macromedia's latest file format docs. A few years back, when I was working on the C++ version of the SDK, the docs from Macromedia sucked big time. They contained a bunch of misinformation and didn't cover a lot of the information inside the swf file format. Since then, Macromedia has restructured it's file format strategy, getting rid of the C++ SDK that they previously offered (good choice, since it was also crap), and focusing mainly on delivering quality docs so that third parties can create better Flash content creation tools (I'm sure the good docs probably had something to do with the Flex team needing some better explaination of the swf format too). This is the first time I've had a chance to really dig deep into the updated docs, and it is quite impressive when you consider the previous state of affairs. In any case, +1 for Macromedia on this one.
And while I'm on the subject, if you want to try out the SwfSource code, please send me an email explaining who you are and what your interest is. We are are pretty selective with the people who get to play with our pre-alpha code, but betas will be a lot easier to get if you aren't accepted for the pre-alpha or alpha.
Some more code samples to tantalize you:
// Write Some Actionscript Bytecode
DoAction doAction = new DoAction();
ActionScriptBuilder builder = doAction.GetActionScriptBuilder();
ByteCodeGenerator generator = builder.GetByteCodeGenerator();
generator.Emit(ActionCode.GetUrl, "http://www.google.com", "_self");
writer.Write(doAction);
// Stream an MP3
using(Stream mp3 = File.OpenRead(filename))
{
Mp3Encoder encoder = new Mp3Encoder(mp3);
SoundStreamHead head = encoder.GetSoundStreamHead(15);
writer.Write(head);
SoundStreamBlock block;
while((block = encoder.GetSoundStreamBlock(15, i, ref mp3FrameOffset, ref delay)) != null)
{
writer.Write(block);
writer.Write(new ShowFrame());
i++;
}
mp3.Close();
}