3

I'm compiling a single .as file into swf using mxmlc.

Whenever I run mxmlc, results are different in size even when the source code is not changed.

For example,

// Test.as
package
{
    public class Test
    {
    }
}

And generates .swf using mxmlc :

mxmlc Test.as

and result size differs from 461 to 465 bytes.

I suppose that it's because of timestamp-like things in compiler, but I could not find how to fix or disable that. Any ideas on generating "same binary from same source" ? Thanks!

Flexx
  • 51
  • 2
  • 1
    So, you're saying using that EXACT test package that if you compile with mxmlc twice, you'll have a different size each time? Your question is not very clear. – J_A_X Apr 12 '11 at 12:11
  • 1
    yes, each time i try `mxmlc Test.as` it generates different Test.swf file in size and contents. – Flexx Apr 13 '11 at 01:29

3 Answers3

2

Finally, I found that metadata tag (Tag Type = 77) and undocumented 'product info' tag (Tag Type = 41) both contains compliation time.

I succeeded to remove timestamps by following steps :

1. open swf and un-zlib
2. clear timestamps in metadata tag and product info tag
3. re-zlib and make new .SWF

But I'm not happy with that, thus this needs extra work on SWF file. I want to find the easier way. there may be 'bypass product info' option on mxmlc..

You can find more information on SWF File structure and metadata tag on http://www.adobe.com/devnet/swf.html and product info on http://wahlers.com.br/claus/blog/undocumented-swf-tags-written-by-mxmlc/

Flexx
  • 51
  • 2
1

You need to override the metadata the compiler is writing into the resulting swf file. You can do this with the -raw-metadata compiler aguement.

Usage:

mxmlc -raw-metadata <XML_String> Test.as

Example:

mxmlc -raw-metadata '' Test.as

(Resulting swf is always 190 bytes).

Matt MacLean
  • 19,410
  • 7
  • 50
  • 53
  • 1
    Thanks for help, but it still generates different file, in size and contents. Metadata(rdf thing) has been cleared, but when I un-zlib swf file I found that there was another timestamp in swf. When you un-zlib the swf above, timestamp is located in 0x37~0x3f. – Flexx Apr 12 '11 at 11:13
0

1 : date in metadata:

mxmlc:

 <metadata date=" " />
 <raw-metadata></raw-metadata>

2 : timestamp in ProductInfo

download sdk source code,and modify the ProductInfo.java,let the timestamp keep same.and then update the ProductInfo.class in your_sdk_dir\lib\swfutils.jar

However,when i have done,Mxmlc also generates different binary on same source.

I think i can't change the compiler link order.

Nightost
  • 1
  • 1