I have a SWF of unknown origin, and I need to know which flash player version it was targeted at wh开发者_如何学Pythonen it was published. How do I get this info?
The 4th byte in the SWF file carries the version number, for example 0A is for Flash Player 10.
EDIT: Because of the high interest this question got I've decided to give more feedback
The first 8 bytes of any SWF file are not compressed, the rest of the file could be compressed (or not) by zlib compression.
- 1st byte: 'F' (not compressed) OR 'C' (compressed).
- 2nd byte: 'W' always.
- 3rd byte: 'S' always.
- 4th byte: version number (09 means this file is targeted at Flash Player 9 and so on...)
- 5th to 8th: Length of entire file in bytes.
The Flex SDK contains a tool called swfdump that displays all of the metadata inside of a SWF file. Here is the beginning of the output when I run "swfdump foo.swf":
<swf xmlns='http://macromedia/2003/swfx' version='9' framerate='24' size='10000x7500' compressed='true'>
This adds on what brian sharon said.
Yes the 1-to-1 mapping of swf-version and Flash Player version is no longer there.
What the 4th byte depicts is the -swf-version, and what's good about this is that there is now a one to one relation with point releases.
Look at these references:
http://blogs.adobe.com/airodynamics/2011/08/16/versioning-in-flash-runtime-swf-version/
http://sleepydesign.blogspot.in/2012/04/flash-swf-version-meaning.html
From the second link:
Compiler Option Flash Player Version
-swf-version=9 9
-swf-version=10 10, 10.1
-swf-version=11 10.2
-swf-version=12 10.3
-swf-version=13 11.0
-swf-version=14 11.1
-swf-version=15 11.2
-swf-version=16 11.3
I am using this information from flash game files to warn users that their flash player might be outdated on my flash games portal. And this works just fine.
Most - all? - of the answers so far are incorrect, which is unfortunate as I was hoping to find an answer to this question :).
Byte 4 of the SWF indicates what version of the SWF file format is used by the SWF. That is not the same as the target player version.
The minimum player version is set at compile time through the compiler option target-player, while the SWF file format version is set through the option swf-version.
The default values for these options can be found inside FLEX_SDK/frameworks/flex-config.xml. For the SDK version I'm using (4.5.1), the defaults are as follows:
<!-- Specifies the minimum player version that will run the compiled SWF. -->
<target-player>10.2.0</target-player>
<!-- Specifies the version of the compiled SWF -->
<swf-version>11</swf-version>
This means swfversion.com shows 11 for my SWF, even though I only require users to have 10.2. And according to http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7a92.html, Flex 4.6 sets target-player to 11.1 and swf-version to 14. So I'm not clear how swfversion.com is at all useful.
You could use DoubleClick's Flash Validator tool:
https://flashval-temp.appspot.com/validator/
It will provide information such as SWF name, version, file size, dimensions, frames per second, compression, and total frames.
Take a gander at the SWF spec from http://www.adobe.com/devnet/swf.html
Then do a hex dump or open the SWF in an editor that can display hex. The SWF version is one of the first few bytes and is before the compressed data starts. I want to say it is byte 4, but I don't totally recall. The value is the version number. IIRC, the point version is not encoded in the SWF.
GNU file may also tell you. I may have edited my rules to do this, though.
精彩评论