JS:
Setting the embed height and width can change the height and width of the flash to obtain.
Copy the code code as follows:
<!DOCTYPE HTML>
<html>
<body>
<embed src="test550X400.swf" id="flash"/>
<script type="text/javascript">
var flash = document.getElementById("flash");
alert("Width: "+flash.width+" Height: "+flash.height);
</script>
</body>
</html>
JAVA:
The size of the flash can be obtained by using java to parse the flash file header information. Special attention should be paid to the fact that there are two types of flash: FWS and CWS. The data part of CWS is in the form of flash compressed by zlib and needs to be decompressed before parsing.
For FWS type flash, the header information contains size information. The parsing method is as follows:
The first three bytes identify the flash type (FWS/CWS);
5, 6, 7, and 8 bytes are the size of the flash file;
Read 5 bits starting from the 9th byte, and set the value to n. After n bits, read n bits, and set the value to x; skip n bits again, read n bits, and set the value to y. The width and height of the swf are x/20 and y/20 pixels respectively