Java and JS to obtain the specific method of flash height and width

  • 2020-03-30 01:06:16
  • OfStack

JS:

Setting the embed height and width can change the height and width of flash to get.
 
<!DOCTYPE HTML> 
<html> 
<body> 

<embed src="test550X400.swf" id="flash" width="550px" height="400px"/> 
<script type="text/javascript"> 
var flash = document.getElementById("flash"); 
alert(" Width: "+flash.width+"  High: "+flash.height); 
</script> 
</body> 
</html> 

JAVA:

The size of flash can be obtained by using Java to parse the flash file header information. It is important to note that there are two types of flash: FWS and CWS. The data part of CWS is in the form of flash after zlib compression, which needs to be decompressed before parsing.

For FWS type flash, the header information contains the size information, and the resolution method is as follows:

The first three bytes identify the type of flash (FWS/CWS);
5,6,7,8 bytes is the size of the flash file;
Starting from the 9th byte, read 5 bits, set the value to n, over n bits, read n bits, set the value to x; Skip n bits, read n bits, and set the value to y. The width and height of the SWF are x/20 and y/20 pixels respectively

Related articles: