A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Parsing SWF header

  1. #1
    Senior Member
    Join Date
    Sep 2002

    Parsing SWF header

    Hello. I am trying to read and parse the header info of my SWF (the first 21 bytes or so). The SWF is just a 550x400 movie with a circle on the screen for testing purposes. I can get the first 3 bytes ("FWS"), the Flash version (8), the total file length (137), but when it comes to getting the RECT for the movie size, I can't get it to work as specified.

    If I read a byte and use the first 5 bits (RECT nBits), it equals the value 24. I can't figure out where it gets 24 from!!! Then I don't know what to do to get the values for the movie size. Shouldn't the values equal 0, 11000, 0, 8000 because that would be the minimumX * 20, maximumX * 20, minimumY * 20, maximumY * 20 (the width and heighth of the movie in TWIPS)?!

    Then there are 8 bytes, then the next two define the FPS (16), and the last two tell me how many frames there are in the main timeline (1). I am stumped.

    Any help with this would be amazing! Also, if the SWF is compressed (begins with "CWS", is the header compressed too?). Thank you

  2. #2
    Registered User
    Join Date
    Feb 2001

    for compressed files, the file size is the uncompressed size (so it can be used to allocate a buffer), remaining data - including the movie size etc - will be compressed.
    Feel free to try out the swf analyzer at www.fontimages.org.uk


  3. #3
    Senior Member
    Join Date
    Sep 2002
    Thanks for the reply, Musicman! I couldn't get the CGI to run. It wanted me to download the CGI file rather than run it on the server. However I did download the source (in C) and ran that. Great program! It deciphered my SWF fine. So something must be wrong with the way I was decoding the rect for the movie size. I'll look at your code when I have more time and figure out what I am doing wrong. Anyway, thanks a ton for the help!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

HTML5 Development Center