Home > Web Front-end > JS Tutorial > Specific method for obtaining flash height and width using Java/JS

Specific method for obtaining flash height and width using Java/JS

PHPz
Release: 2018-09-30 17:20:43
Original
1019 people have browsed it

This article will introduce in detail how to obtain the height and width of flash using Java/JS. There is a good example below. Interested friends can refer to it. I hope it will be helpful to everyone.

JS:

Setting the embed height and width can change the height and width of the flash to obtain.

<!DOCTYPE HTML> 
<html> 
<body> 
<embed src="test550X400.swf" id="flash" width="550px" height="400px"/> 
<script type="text/javascript"> 
var flash = document.getElementById("flash"); 
alert("宽:"+flash.width+" 高:"+flash.height); 
</script> 
</body> 
</html>
Copy after login

JAVA:

Use java to parse the flash file header information to get the size of the flash. 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 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 type of flash (FWS/CWS);
5 , 6, 7, and 8 bytes are the size of the flash file;
Read 5 bits from the 9th byte, and set the value to n. After n bits, read n bits, and set the value to x; Skip again n bits, read n bits, set the value to y. The width and height of the swf are x/20 and y/20 pixels respectively.

The above is the entire content of this chapter. For more related tutorials, please visit JavaScript Video Tutorial!

Related labels:
js
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template