Flex: Get a Popup to scroll with the rest of application [duplicate]
Possib开发者_JAVA百科le 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:
After I scroll the page it looks like this:
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>
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 .
精彩评论