Flex:获取一个弹出窗口以与应用程序的其余部分一起滚动

发布于 2024-12-07 05:28:51 字数 2300 浏览 0 评论 0原文

可能的重复:
Flex 弹出窗口的定位/滚动问题

我正在尝试获取主控制栏在我的应用程序上控制使用 PopUpManager.createPopUp(this,JakePanel,false); 打开的弹出窗口的位置。

最初页面看起来像这样:

在此处输入图像描述

滚动页面后,它看起来像这样:

在此处输入图像描述

我想要的是弹出窗口与其他所有内容一起滚动。有办法做到这一点吗?

这是我的代码:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark" 
               xmlns:mx="library://ns.adobe.com/flex/mx" 
               verticalScrollPolicy="on"
               horizontalScrollPolicy="on"
               layout="absolute">

    <fx:Script>
        <![CDATA[
            import mx.containers.Panel;
            import mx.managers.PopUpManager;


            public function buttonClick():void {
                PopUpManager.createPopUp(this,JakePanel,false);
            }
        ]]>
    </fx:Script>

    <mx:VBox>
        <mx:Image width="2000"
                  source="@Embed(source='assets/image.jpg')"/> 
        <mx:Button click="{buttonClick()}" label="Launch"/>
    </mx:VBox>
</mx:Application>

和弹出代码:

<?xml version="1.0" encoding="utf-8"?>
<mx:Panel xmlns:fx="http://ns.adobe.com/mxml/2009" 
          xmlns:s="library://ns.adobe.com/flex/spark" 
          xmlns:mx="library://ns.adobe.com/flex/mx" 
          layout="vertical" 
          width="400" height="300"
          title="Popup"
          initialize="{init()}"
          >
    <fx:Script>
        <![CDATA[

            import mx.managers.PopUpManager;


            public function init():void {

            }

            public function close():void {
                PopUpManager.removePopUp(this);
            }           
        ]]>
    </fx:Script>
    <s:TextArea text="Enter more text here: " width="100%" height="200"/>
    <s:Button label="OK" click="{close()}" width="100%" height="30" />
</mx:Panel>

Possible Duplicate:
Positioning / Scrolling problem with Flex popup

I am trying to get the main control bar on my application to control the location of a popup that has been opened using PopUpManager.createPopUp(this,JakePanel,false);.

Initially the page looks like this:

enter image description here

After I scroll the page it looks like this:

enter image description here

What I would like is for the Popup to scroll with everything else. Is there a way to do this?

Here is my code:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark" 
               xmlns:mx="library://ns.adobe.com/flex/mx" 
               verticalScrollPolicy="on"
               horizontalScrollPolicy="on"
               layout="absolute">

    <fx:Script>
        <![CDATA[
            import mx.containers.Panel;
            import mx.managers.PopUpManager;


            public function buttonClick():void {
                PopUpManager.createPopUp(this,JakePanel,false);
            }
        ]]>
    </fx:Script>

    <mx:VBox>
        <mx:Image width="2000"
                  source="@Embed(source='assets/image.jpg')"/> 
        <mx:Button click="{buttonClick()}" label="Launch"/>
    </mx:VBox>
</mx:Application>

And the popup code:

<?xml version="1.0" encoding="utf-8"?>
<mx:Panel xmlns:fx="http://ns.adobe.com/mxml/2009" 
          xmlns:s="library://ns.adobe.com/flex/spark" 
          xmlns:mx="library://ns.adobe.com/flex/mx" 
          layout="vertical" 
          width="400" height="300"
          title="Popup"
          initialize="{init()}"
          >
    <fx:Script>
        <![CDATA[

            import mx.managers.PopUpManager;


            public function init():void {

            }

            public function close():void {
                PopUpManager.removePopUp(this);
            }           
        ]]>
    </fx:Script>
    <s:TextArea text="Enter more text here: " width="100%" height="200"/>
    <s:Button label="OK" click="{close()}" width="100%" height="30" />
</mx:Panel>

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

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

发布评论

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

评论(1

唐婉 2024-12-14 05:28:51

PopUpManager 将弹出的内容添加到不同的父级。它实际上在主舞台之外。

要通过滚动更新位置,您需要向正在进行滚动的组件添加事件侦听器并手动更新面板的位置。在您的情况下,将处理程序添加到 .

PopUpManager adds the popped up content to a different parent. It's actually outside of the main stage.

To have the position update with scrolling you would need to add event listeners to the component that is doing the scrolling and manually update the panel's position. In your case add the handler to the .

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