Adobe Air - 显示对话框时如何调暗背景(标题窗口)

时间:2015-07-29 12:18:36

标签: actionscript-3 flex air adobe

假设我有以下mxml:

<view...>

  <s:VGroup width="100%" height="100%">
      <s:Button label="some label"/>
      <s:Button label="some other label"/>
      <s:Button label="yet another label"/>
      <s:Button label="one last label"/>
  </s:VGroup>

  <s:TitleWindow includeIn="abandon" id="dlgAbandon" title="Question">
        <s:VGroup horizontalAlign="center" paddingTop="8" paddingBottom="8" paddingLeft="20" paddingRight="20" gap="10" width="100%" height="100%">
            <s:Label text="Why?" color="{Constants.ChromeColor}" fontWeight="bold"/>
            <s:VGroup width="100%" gap="10">
                <s:Button label="reason 1" width="100%" id="btnR1"  click="onDlgWhyNotClose('reason 1')"/>
                <s:Button label="reason 2" width="100%" id="btnR1"  click="onDlgWhyNotClose('reason 2')"/>
                <s:Button label="reason 3" width="100%" id="btnR1"  click="onDlgWhyNotClose('reason 3')"/>
            </s:VGroup>
        </s:VGroup>
    </s:TitleWindow>

</view>

现在在我的代码中,我将currentState更改为&#34;放弃&#34;所以对话框显示在VGroup的顶部。

如何调暗对话框背后的背景(VGroup中的所有内容甚至是其父视图 - 视图)?当对话框关闭时,我怎么能解开呢?

谢谢: - )

阿维

1 个答案:

答案 0 :(得分:0)

快速解决方案是为此状态添加半透明背景,例如

<view...>

<s:VGroup width="100%" height="100%">
  <s:Button label="some label"/>
  <s:Button label="some other label"/>
  <s:Button label="yet another label"/>
  <s:Button label="one last label"/>
</s:VGroup>

<s:SkinnableContainer includeIn="abandon" 
                      width="100%"
                      height="100%"
                      backgroundColor="#000000"
                      backgroundAlpha="0.3">

    <s:TitleWindow id="dlgAbandon" title="Question">
        <s:VGroup horizontalAlign="center" paddingTop="8" paddingBottom="8" paddingLeft="20" paddingRight="20" gap="10" width="100%" height="100%">
        <s:Label text="Why?" color="{Constants.ChromeColor}" fontWeight="bold"/>
            <s:VGroup width="100%" gap="10">
                <s:Button label="reason 1" width="100%" id="btnR1"  click="onDlgWhyNotClose('reason 1')"/>
                <s:Button label="reason 2" width="100%" id="btnR1"  click="onDlgWhyNotClose('reason 2')"/>
                <s:Button label="reason 3" width="100%" id="btnR1"  click="onDlgWhyNotClose('reason 3')"/>
            </s:VGroup>
        </s:VGroup>
    </s:TitleWindow>

</s:SkinnableContainer>

</view>

注意,现在SkinnableContainer包含在放弃状态而不仅仅是TitleWindow