Apache flex 如何防止弹出标题窗口后面的项目接收鼠标事件?

Apache flex 如何防止弹出标题窗口后面的项目接收鼠标事件?,apache-flex,flex-spark,Apache Flex,Flex Spark,我有一个弹出窗口蒙皮的标题窗口,我用它作为弹出窗口,但它后面的项目接收鼠标点击事件。是否有一个选项可以防止mousevents发生在窗口的主内容组后面 编辑:澄清-我不是在问如何创建窗口模式。当用户单击contentGroup皮肤部分的某个区域时,弹出窗口后面的项目(不是在主窗体上,而是在侧面,而是在后面和隐藏)接收鼠标事件。如果用户单击该组中的项目,则不会发生这种情况,但稍有遗漏可能会触发意外的背景按钮。当您创建弹出设置时modal=true。比如: var-pop:MyPopUpClass=

我有一个
弹出窗口
蒙皮的
标题窗口
,我用它作为弹出窗口,但它后面的项目接收鼠标点击事件。是否有一个选项可以防止mousevents发生在窗口的主内容组后面


编辑:澄清-我不是在问如何创建窗口模式。当用户单击
contentGroup
皮肤部分的某个区域时,弹出窗口后面的项目(不是在主窗体上,而是在侧面,而是在后面和隐藏)接收鼠标事件。如果用户单击该组中的项目,则不会发生这种情况,但稍有遗漏可能会触发意外的背景按钮。

当您创建弹出设置时
modal=true
。比如:


var-pop:MyPopUpClass=PopUpManager.createPopUp(父级,MyPopUpClass,true)作为MyPopUpClass

当您创建弹出设置时
modal=true
。比如:


var-pop:MyPopUpClass=PopUpManager.createPopUp(父级,MyPopUpClass,true)作为MyPopUpClass

您需要将弹出窗口设置为模式窗口。当你将某个东西设置为模态时,这意味着窗口(警报、弹出窗口、标题窗口等)将保持在顶部,屏幕的其余部分将冻结,直到顶部窗口关闭

“PopUpManager还提供了一种方式,这样弹出窗口下面的窗口就不能接收鼠标事件,如果用户在窗口外单击鼠标,也会提供一个事件,因此开发人员可以选择关闭窗口或警告用户。”

模态的默认值为
false
。当
addPopup
createPopup

public static function addPopUp(window:IFlexDisplayObject, parent:DisplayObject, modal:Boolean = false, childList:String = null):void 

public static function createPopUp(parent:DisplayObject, className:Classe, modal:Boolean = false, childList:String = null):IFlexDisplayObject 

您需要将弹出窗口设置为模式窗口。当你将某个东西设置为模态时,这意味着窗口(警报、弹出窗口、标题窗口等)将保持在顶部,屏幕的其余部分将冻结,直到顶部窗口关闭

“PopUpManager还提供了一种方式,这样弹出窗口下面的窗口就不能接收鼠标事件,如果用户在窗口外单击鼠标,也会提供一个事件,因此开发人员可以选择关闭窗口或警告用户。”

模态的默认值为
false
。当
addPopup
createPopup

public static function addPopUp(window:IFlexDisplayObject, parent:DisplayObject, modal:Boolean = false, childList:String = null):void 

public static function createPopUp(parent:DisplayObject, className:Classe, modal:Boolean = false, childList:String = null):IFlexDisplayObject 

如果您不是在寻找
模式
答案,那么我建议您在弹出窗口打开时删除所有相关的侦听器,并在弹出窗口被删除时重新添加它们

x.removeEventListener(MouseEvent.CLICK...
PopUpManager.addPopup(...


onClose(...
x.addEventListener(MouseEvent.CLICK...

如果您不是在寻找
模式
答案,那么我建议您在弹出窗口打开时删除所有相关的侦听器,并在弹出窗口被删除时重新添加它们

x.removeEventListener(MouseEvent.CLICK...
PopUpManager.addPopup(...


onClose(...
x.addEventListener(MouseEvent.CLICK...

我通过替换这个解决了这个问题:

<s:SparkSkin ...>
<s:Rect height="{hostComponent.height}" radiusX="10" width="{hostComponent.width}">
    <s:fill>
        <s:SolidColor color="#F5F4EB"/>
    </s:fill>
</s:Rect>

<!-- header, move area, close button and other details -->
<s:Group id="contentGroup"
     top="40"
     left="10"
     right="10"
     bottom="10">

</s:Group>
</s:SparkSkin>

为此:

<s:SparkSkin ...>
<s:Rect height="{hostComponent.height}" radiusX="10" width="{hostComponent.width}">
    <s:fill>
        <s:SolidColor color="#F5F4EB"/>
    </s:fill>
</s:Rect>
<!-- header, move area, close button and other details -->
<s:Group top="40"
     left="10"
     right="10"
     bottom="10">
    <s:Rect top="0"
        left="0"
        right="0"
        bottom="0">
        <s:fill>
            <s:SolidColor color="0xF5F4EB" />
        </s:fill>
    </s:Rect>
    <s:Group id="contentGroup"
             top="0"
             left="0"
             right="0"
             bottom="0">

    </s:Group>
</s:Group>
</s:SparkSkin>


在组后面创建一个矩形对象使其正常接受单击事件。

我通过替换以下内容解决了此问题:

<s:SparkSkin ...>
<s:Rect height="{hostComponent.height}" radiusX="10" width="{hostComponent.width}">
    <s:fill>
        <s:SolidColor color="#F5F4EB"/>
    </s:fill>
</s:Rect>

<!-- header, move area, close button and other details -->
<s:Group id="contentGroup"
     top="40"
     left="10"
     right="10"
     bottom="10">

</s:Group>
</s:SparkSkin>

为此:

<s:SparkSkin ...>
<s:Rect height="{hostComponent.height}" radiusX="10" width="{hostComponent.width}">
    <s:fill>
        <s:SolidColor color="#F5F4EB"/>
    </s:fill>
</s:Rect>
<!-- header, move area, close button and other details -->
<s:Group top="40"
     left="10"
     right="10"
     bottom="10">
    <s:Rect top="0"
        left="0"
        right="0"
        bottom="0">
        <s:fill>
            <s:SolidColor color="0xF5F4EB" />
        </s:fill>
    </s:Rect>
    <s:Group id="contentGroup"
             top="0"
             left="0"
             right="0"
             bottom="0">

    </s:Group>
</s:Group>
</s:SparkSkin>

在组后面创建矩形对象使其正常接受单击事件。

尝试使用该属性。

尝试使用该属性