如何根据屏幕尺寸调整 .swf 文件的大小?
我有一个包含大型 .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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以生成
检索窗口宽度/高度的方法可能会因浏览器而异,但我确信您可以在网上找到一种可靠的跨浏览器方法来执行此操作。
如果您需要在调整窗口大小时动态调整大小,则可以将处理程序附加到 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: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 theirwidth
andheight
properties. Probably. I haven't tested any of this.如果您直接链接到 swf 文件(不将其嵌入任何页面),它将是全屏的。
If you link directly to the swf file (not embedding it in any page) it'll be full-screen.