Flex中有类似html的固定定位吗?

发布于 2024-12-18 16:10:52 字数 147 浏览 3 评论 0原文

我正在尝试在弹性应用程序中创建一个弹出通知,该应用程序在窗口的左下角有一个固定位置。即使浏览器调整大小或滚动,弹出窗口 (mx.TitleWindow) 也将随浏览器固定。将bottom属性设置为0,但当浏览器窗口调整大小或滚动时,它不起作用。有没有办法将弹出窗口固定在浏览器上?

I'm trying to create a popup notification in a flex application that has a fix position on the lower left corner of the window. The popup (mx.TitleWindow) will be fixed with the browser even if the browser is resized or scrolled. Setting the bottom property to 0, but it does not work when the browser window resize or scrolls. Is there a way to set the popup fixed to the browser?

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

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

发布评论

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

评论(1

若沐 2024-12-25 16:10:52

为了实现这一点,弹出窗口父级(在本例中,创建弹出窗口并使用 PopUpManager 的组件,而不是 addPopUp 的第二个参数)应该知道应用程序何时更改其尺寸并将弹出窗口放置在适当的位置。尝试在主应用程序中添加调整大小侦听器并从中分派自定义事件。在弹出窗口父级中侦听此事件,然后在相应的事件处理程序中重新定位弹出窗口:

 var application:UIComponent = FlexGlobals.topLevelApplication as UIComponent
 popup.x = 5;
 popup.y = application.height - 170;

请注意,这些坐标是相对于浏览器中当前查看的区域的。这样您就可以将弹出窗口放置在固定位置(在本例中为左下角)。如果可能的话,尝试使用UI组件失效机制,以避免重复的维度计算。

解决该问题的另一种方法是在主应用程序中实现管理弹出窗口的机制。在这两种情况下,定位代码应该是这样的。

In order to achieve this the popup parent (in this case, the component which creates the popup and uses PopUpManager, not the second argument of addPopUp) should know when the application changes its dimensions and position the popup on the appropriate place. Try to add a resize listener in your main application and dispatch a custom event from it. Listen for this event in the popup parent and then reposition the popup in the corresponding event handler with:

 var application:UIComponent = FlexGlobals.topLevelApplication as UIComponent
 popup.x = 5;
 popup.y = application.height - 170;

Mind that these coordinates are relative to the currently viewed area in the browser. This way you can place the popup on a fixed position (in this case, in the lower left corner). Try to use the UI component invalidation mechanisms, if possible, to avoid duplicate dimension calculation.

The other way to solve the problem is to implement the mechanics for managing popups in the main application. In both cases the positioning code should be something like this.

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