在 Adob​​e Flex/AIR 应用程序中调整应用程序窗口大小时调整容器大小

发布于 2024-10-20 11:09:55 字数 150 浏览 6 评论 0原文

我正在开发 Adob​​e AIR 应用程序。应用程序窗口的大小为800X600,包含边框容器,边框容器包含许多控件。

我想要的是,如果用户重新调整应用程序的大小,那么该容器也应该根据比例重新调整大小。即,如果用户最大化或最小化窗口,则该边框容器也应分别最大化或最小化。

I am working on an Adobe AIR Application. The size on Application window is 800X600 and is contains border container and border container contains many controls.

What I want is to if user re-sizes the application then that container should also be re-sized according to scale. i.e If user maximizes or minimizes the window then that border container should also be maximized or minimized respectively.

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

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

发布评论

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

评论(3

婴鹅 2024-10-27 11:09:55

如果您不想(或由于某种原因不能)使用基于百分比的宽度,那么您始终可以在 MXML 中执行以下操作:

<s:BorderContainer 
    xmlns:mx = "http://www.adobe.com/2006/mxml"
    xmlns:s = "library://ns.adobe.com/flex/spark"

    width = "{parentApplication.width / 2}"
    height = "{parentApplication.height / 2}">

您只需获取对组件的parentApplication 的引用并直接绑定到其宽度和高度。把你想要的任何数学都放在最后。

If you don't want to (or can't for some reason) use percentage based widths then you can always just do the following in MXML:

<s:BorderContainer 
    xmlns:mx = "http://www.adobe.com/2006/mxml"
    xmlns:s = "library://ns.adobe.com/flex/spark"

    width = "{parentApplication.width / 2}"
    height = "{parentApplication.height / 2}">

You are just getting a reference to the component's parentApplication and directly binding to its width and height. Throw whatever math you want on the end.

叹倦 2024-10-27 11:09:55

一种更简单的方法是让您的组件声明它们相对于其外部容器的大小/位置。例如,不要设置 x、y、宽度和高度,而是在应用程序组件以及应用程序中的容器中设置左、右、顶部和底部。如果要强制最小尺寸为 800x600,可以设置 minWidth 和 minHeight 属性。希望有帮助。

An easier way to do this is to have your components declare their sizes/positions relative to their outer containers. For example, rather than setting x, y, width and height, set left, right, top and bottom in your Application component as well as the containers within your Application. If you want to enforce a minimum size of 800x600, you can set the minWidth and minHeight properties. Hope that helps.

清风夜微凉 2024-10-27 11:09:55

这可以使用 MVC 框架来完成。一些选项包括 RobotLegsMateCairngorm 或者可以使用一些快速设计模式并实施自定义版本。

本质上,Application 事件。应检测 RESIZE 并将其应用于容器。 stageHeight 和 stageWidth 的属性将提供调整容器大小所需的信息。

在任何情况下,调整大小事件都将遍历显示层次结构,但如果自定义事件或函数应用于控件,则可以方便地在应用程序级别进行拦截。

This can be accomplished using an MVC framework. Some options include RobotLegs, Mate, Cairngorm or it is possible to use some quick design patterns and implement a custom version.

Essentially, the Application event Event.RESIZE should be detected and applied to the container. The properties of stageHeight and stageWidth will give the necessary info to resize the container.

Resize events will traverse the display hierarchy in any case, but it's convenient to intercept at the application level, should a custom event or function apply to the controls.

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