使用 swfobject 动态高度和宽度
swfObject embed 具有以下签名,
swfobject.embedSWF(swfUrlStr, ReplaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn)
具有宽度和高度所需的属性,
我可以做什么来表示动态高度和宽度。
swfObject embed has the following signature,
swfobject.embedSWF(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn)
with width and heigth required attributes,
What can I do to signify dynamic height and width.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
阅读此答案并在网上浏览更多内容后,我想出了解决该问题的方法。
我有一个包含多个房间的弹性应用程序,每个房间都有不同的高度。
我所做的是将 swfobject 设置为应用程序所需的最小高度。
在我的 Flex 应用程序的构造中,我附加到应用程序中组件的 ResizeEvent 和 MoveEvent 事件,因此每当对象移动或调整大小时,我都可以轻松计算应用程序的新高度。
当我捕获其中一个事件时,我调用 resizeSwfObject javascript 函数,并将新的所需高度传递给它。
该 JavaScript 函数在 Flash 对象容器/元素的 .style.height 属性上设置新值。
幼崽
after reading this answer and browsing some more on the net i came up with a solution to the problem.
I have a flex application with several rooms and each room has a different height.
what i did is set swfobject with the minimum height that I need for my application.
In the construct of my flex application i attached to the ResizeEvent and MoveEvent events of the components in my application, so whenever an object moves or resized I can easily calculate the new height of my application.
when I catch one of these events I call a resizeSwfObject javascript function and I pass it the new desired height.
that javascript function sets a new value on the .style.height attribute of the flash object container/element.
Kfir
浏览器不可能确定应用程序的大小并据此自动更改对象的大小。
It's not possible for the browser to determine the size of the application and change the object's size automatically based on that.
创建一个容器元素,并将容器的宽度/高度设置为您想要的任何值。然后以 100% 宽度和 100% 高度将 SWF 嵌入容器内。
请参阅这个 StackOverflow 问题:
使用 SWFObject 加载 SWF 时调整其大小
Create a container element, and set the width/height of the container to whatever you desire. Then embed the SWF with 100% width and 100% height inside your container.
See this StackOverflow question:
Resize an SWF when loading it with SWFObject
我不完全确定动态高度和宽度是什么意思,但据我所知,您需要以像素或百分比(周围元素的)指定宽度和高度,而且我不知道有什么方法可以让 swf 的大小决定,就像您可以使用 img 标签一样,通过省略宽度和高度。
I am not entirely sure what you mean by dynamic height and width, but as far as I know, you need to specify width and height either in pixels or percent (of the surrounding element), and I don't know of any way to let the size of the swf decide, like you can do for example with an img tag, by leaving out width and height.