JS:
设置 embed 高度和宽度可以改变 flash 的高度和宽度,从而获取。
<!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>
JAVA:
利用java解析flash文件头信息可以得到flash的尺寸,需要特别注意的是flash有两种类型:FWS,CWS。CWS的数据部分是flash经过zlib压缩后的形式,解析前需要先解压。
对于FWS类型的flash其头信息中包含了尺寸信息,解析方法如下:
前三个字节标识了flash的类型(FWS/CWS);
5,6,7,8字节为该flash文件的大小;
从第9个字节起读5 bits,设值为n, 越过n bits,读n bits,设值为x; 再跳过n bits,读取n bits,设值为y。 swf的宽度和高度依次为x/20和y/20像素
本文地址:https://www.stayed.cn/item/4707
转载请注明出处。
本站部分内容来源于网络,如侵犯到您的权益,请 联系我