重新调整 Flash 对象的大小无法正常工作
Re-sizing of a flash object not working correctly
我正在制作一个 Flash 画廊,对于这个画廊,我希望视频有一定的大小。当我第一次开始使用它时,闪光灯非常小,而且无法正确调整自身大小。昨晚深夜,我让它工作到正确的大小,但无论出于何种原因,它似乎占据了整个 body 标签并将所有其他元素推入 html 元素。作为示例,我放置了一个 h1 标签来展示它是如何做到这一点的。我正在使用 swffit 和 swfobject 来使闪光灯工作,但我几乎肯定问题出在 swffit 或什至是我的代码上。我开始为此制作一个 jsfiddle 示例,但它对我试图放入其中的任何 flash 对象都非常敏感。如有任何帮助,我们将不胜感激。
SWFOBJECT:https://github.com/swfobject/swfobject.git
SWFFIT:http://swffit.millermedeiros.com/
HTML 和 JAVASCRIPT
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Flash Test</title>
<meta name="description" content="Flash stuff">
<meta name="author" content="SitePoint">
<link rel="stylesheet" href="styles/style.css">
<script src="js/swfobject.js"></script>
<script src="js/swffit.js"></script>
<script type="text/javascript">
var height = window.innerHeight - 160;
var width = window.innerWidth - 140;
if ((height * 1.375) < width) {
width = height * 1.375;
} else {
height = width / 1.375;
}
</script>
<script type="text/javascript">
var flashvars = {},
//params = {wmode:"transparent"},
params = {},
attributes = {};
swfobject.embedSWF("swfs/scoob.swf", "moviefun", width -140, height -160, "9.0.0", "js/swfobject.js", flashvars, params, attributes);
swffit.fit("moviefun", "1", "1", width, height, true, false);
</script>
</head>
<body>
<script type="text/javascript">
window.onresize = doResize;
function doResize() {
height = window.innerHeight - 160;
width = window.innerWidth - 140;
if ((height * 0.7175) < width) {
width = height * 0.7175;
} else {
height = width / 0.7175;
};
swffit.fit("moviefun", "1", "1", width, height, true, false)
}
</script>
<div>
<h1 id="mainText">Hey there</h1>
<div id="moviefun">It didn't work prob bc of internet explorer... if not though can't help ya......</div>
</div>
<script src="scripts.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-beta1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
</body>
</html>
CSS
body {
background-color: red;
font-family: Verdana, Arial, Helvetica, sans-serif;
color: #FFFFFF;
font-size: 10px;
}
#moviefun {
position: absolute;
top: 0px;
left: 70px;
background-color: red;
}
#mainText {
background: yellow;
}
这是问题的图片,它比预期的要小,但仍将其他所有内容推入 HTML 标签
调整 SWF 文件的大小最好通过调整父容器的大小来处理。参见 Resize an SWF when loading it with SWFObject
我正在制作一个 Flash 画廊,对于这个画廊,我希望视频有一定的大小。当我第一次开始使用它时,闪光灯非常小,而且无法正确调整自身大小。昨晚深夜,我让它工作到正确的大小,但无论出于何种原因,它似乎占据了整个 body 标签并将所有其他元素推入 html 元素。作为示例,我放置了一个 h1 标签来展示它是如何做到这一点的。我正在使用 swffit 和 swfobject 来使闪光灯工作,但我几乎肯定问题出在 swffit 或什至是我的代码上。我开始为此制作一个 jsfiddle 示例,但它对我试图放入其中的任何 flash 对象都非常敏感。如有任何帮助,我们将不胜感激。
SWFOBJECT:https://github.com/swfobject/swfobject.git
SWFFIT:http://swffit.millermedeiros.com/
HTML 和 JAVASCRIPT
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Flash Test</title>
<meta name="description" content="Flash stuff">
<meta name="author" content="SitePoint">
<link rel="stylesheet" href="styles/style.css">
<script src="js/swfobject.js"></script>
<script src="js/swffit.js"></script>
<script type="text/javascript">
var height = window.innerHeight - 160;
var width = window.innerWidth - 140;
if ((height * 1.375) < width) {
width = height * 1.375;
} else {
height = width / 1.375;
}
</script>
<script type="text/javascript">
var flashvars = {},
//params = {wmode:"transparent"},
params = {},
attributes = {};
swfobject.embedSWF("swfs/scoob.swf", "moviefun", width -140, height -160, "9.0.0", "js/swfobject.js", flashvars, params, attributes);
swffit.fit("moviefun", "1", "1", width, height, true, false);
</script>
</head>
<body>
<script type="text/javascript">
window.onresize = doResize;
function doResize() {
height = window.innerHeight - 160;
width = window.innerWidth - 140;
if ((height * 0.7175) < width) {
width = height * 0.7175;
} else {
height = width / 0.7175;
};
swffit.fit("moviefun", "1", "1", width, height, true, false)
}
</script>
<div>
<h1 id="mainText">Hey there</h1>
<div id="moviefun">It didn't work prob bc of internet explorer... if not though can't help ya......</div>
</div>
<script src="scripts.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-beta1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
</body>
</html>
CSS
body {
background-color: red;
font-family: Verdana, Arial, Helvetica, sans-serif;
color: #FFFFFF;
font-size: 10px;
}
#moviefun {
position: absolute;
top: 0px;
left: 70px;
background-color: red;
}
#mainText {
background: yellow;
}
这是问题的图片,它比预期的要小,但仍将其他所有内容推入 HTML 标签
调整 SWF 文件的大小最好通过调整父容器的大小来处理。参见 Resize an SWF when loading it with SWFObject