There has always been such a problem, that is, when you upload a flash file, the width and height of the input flash must be included; otherwise, the ratio of the flash is abnormal because you do not know these values.
Recently, my website also involves this problem, so I plan to solve it.
First, search on Google to find the JavaScript code for obtaining the flash width and height, but it is not before the flash is loaded, and the width and height of the object tag cannot be dynamically changed, the most important thing is that there is Flash Player's security warning information, so I gave up reading on the client and turned to the server.
Import flash in. the OCX control tries to obtain the Flash file information. The result of calling the tgetproperty () method is always to return the e_fail error and fails. net.
There is only one method left, and the most feasible method is to directly read The Flash file and analyze the format.
Search on GoogleMacromedia Flash (SWF) File Format Specification Version 7Http://www.xiaowowo.com/gt_book/new/flashfileformat.rar)
After reading and trying again, I finally wrote the flashinfo class. The Calling method is as follows:
Flashinfo = New Flashinfo ( @" C: \ test.swf " ); // Constructor. The parameter is the flash file address.
Console. writeline ( String . Format ( " Version: {0} " , Flashinfo. Version); // flash version
Console. writeline ( String . Format ( " Compressed: {0} " , Flashinfo. iscompressed); // whether it is compressed
Console. writeline ( String . Format ( " Width: {0} " , Flashinfo. width); // flash width
Console. writeline ( String . Format ( " Height: {0} " , Flashinfo. Height); // flash height
Console. writeline ( String . Format ( " Framerate: {0} " , Flashinfo. framerate); // Frame Rate
Console. writeline ( String . Format ( " Framecount: {0} " , Flashinfo. framecount); // The total number of frames.
Console. writeline ( String . Format ( " Filelength: {0} " , Flashinfo. filelength); // file size when not compressed
Since the Flash format version 6, added the compression option, with zlib compression, in order to support the compression format, had to find a zlib. Net wrapper (http://zlibnetwrapper.sourceforge.net/) on Google /)
Flashinfo classSource codeAnd compiled library files provided to friends who have the same needs download: http://files.cnblogs.com/gmm/FlashInfo.zip
The level is limited, and the shortcomings are inevitable. please correct me!