如何根据屏幕尺寸调整 .swf 文件的大小?

发布于 2024-09-07 11:37:41 字数 135 浏览 7 评论 0原文

我有一个包含大型 .swf 文件的网站。但是,当屏幕较小的人查看网站时,我希望 .swf(占据整个屏幕)调整大小以完全适合。就像在大多数 Flash 网站上查看时它们完美地适合屏幕一样,但是当在屏幕较小的计算机上查看时,它们会调整大小并仍然再次完美地适合。

I have a website with a large .swf file. However when people with smaller screens view the website, I would like the .swf (which takes up the entire screen) to resize to fit on exactly. Just like how on most flash sites when viewed they fit the screen perfectly, however also then when viewed on computers with smaller screens they resize and still fit perfectly again.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

不一样的天空 2024-09-14 11:38:39

您可以生成 标记,该标记通过 JavaScript 嵌入 SWF 文件,并根据包含窗口的大小以编程方式打印宽度和高度。例如:

<script type="text/javascript">
  var w=window.innerWidth, h=window.innerHeight;
  document.write('<object width="' + w + '" height="' + h + '">');
  document.write('  <param name="movie" value="x.swf">');
  document.write('  <embed src="x.swf" width="100%" height="100%"></embed>');
  document.write('</object>');
</script>

检索窗口宽度/高度的方法可能会因浏览器而异,但我确信您可以在网上找到一种可靠的跨浏览器方法来执行此操作。

如果您需要在调整窗口大小时动态调整大小,则可以将处理程序附加到 window.onresize 事件,该事件检索必要的对象并嵌入 DOM 元素并更改其宽度和 height 属性。大概。我还没有测试过这些。

You could generate the <object> tag which embeds the SWF file via JavaScript and print the width and height programmatically based on the size of the containing window. For example:

<script type="text/javascript">
  var w=window.innerWidth, h=window.innerHeight;
  document.write('<object width="' + w + '" height="' + h + '">');
  document.write('  <param name="movie" value="x.swf">');
  document.write('  <embed src="x.swf" width="100%" height="100%"></embed>');
  document.write('</object>');
</script>

The method for retrieving the window width/height will probably vary per browser but I'm sure you can find a reliable, cross-browser way to do it somewhere online.

If you need to dynamically resize whenever the window is resized then you can attach a handler to the window.onresize event which retrieves the necessary object and embed DOM elements and change their width and height properties. Probably. I haven't tested any of this.

安静被遗忘 2024-09-14 11:38:33

如果您直接链接到 swf 文件(不将其嵌入任何页面),它将是全屏的。

If you link directly to the swf file (not embedding it in any page) it'll be full-screen.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文