Flex:createPopUp ->使除滚动条之外的所有内容均为模态
我制作了这个简单的应用程序来演示我的问题。它有:
- 一个图像
- 一个启动弹出窗口的按钮
- 侧面的滚动条
<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="vertical">
<fx:Script>
<![CDATA[
import mx.managers.PopUpManager;
public function buttonClick():void {
PopUpManager.createPopUp(this,JakePanel,true);
}
]]>
</fx:Script>
<mx:Image width="2000"
source="@Embed(source='assets/image.jpg')"/>
<mx:Button click="{buttonClick()}" label="Launch"/>
</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"
>
<fx:Script>
<![CDATA[
import mx.managers.PopUpManager;
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.createPopUp(this,JakePanel,true);
。最后一个参数指定弹出窗口是“模式”的,并且它应该捕获所有鼠标事件。我还需要允许在弹出窗口打开时启用主滚动条。我的用户通常会在非常小的屏幕中打开应用程序,并且无法调整应用程序的大小。例如:
当应用程序太小而无法单击“确定”按钮时,就会出现问题:
有没有办法使除主滚动条之外的所有内容都“模态”?我知道我可以在面板上放置一个滚动条,但我宁愿避免这种情况。
I made this simple application to demonstrate my problem. It has:
- An image
- A button that launchess a popup window
- Scroll bars on the side
<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="vertical">
<fx:Script>
<![CDATA[
import mx.managers.PopUpManager;
public function buttonClick():void {
PopUpManager.createPopUp(this,JakePanel,true);
}
]]>
</fx:Script>
<mx:Image width="2000"
source="@Embed(source='assets/image.jpg')"/>
<mx:Button click="{buttonClick()}" label="Launch"/>
</mx:Application>
When the launch button is pressed it launches this popup window:
<?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"
>
<fx:Script>
<![CDATA[
import mx.managers.PopUpManager;
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>
These are my requirements
When the popup is open I need to be able to disable everything except the popup. To do this I am using:
PopUpManager.createPopUp(this,JakePanel,true);
. The last parameter specifies that the popup is "modal" and that it should capture all mouse events.I also need to allow the main scroll bars to be enabled while the popup is open. Often my users will have the app open in a very small screen and will not be able to resize the app. For example:
This is a problem when the app is too small to click the ok button:
Is there a way to make everything "modal" except the main scroll bars? I know that I could put a scrollbar on the Panel but I would prefer to avoid this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为最好的方法是:
标记中。allYourStuff.enabled = false
allYourStuff.enabled = true
I think that the best way to do this is to:
<mx:hgroup id="allYourStuff">
tag.allYourStuff.enabled = false
allYourStuff.enabled = true