【问题标题】:Adobe Air - How to dim background when displaying a dialog (title window)Adobe Air - 如何在显示对话框(标题窗口)时使背景变暗
【发布时间】:2015-07-29 12:18:36
【问题描述】:

假设我有以下 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 更改为“abandon”,这样对话框就会显示在 VGroup 的顶部。

如何使对话框后面的背景变暗(VGroup 中的所有内容,甚至是其父级 - 视图)?对话框关闭时如何取消它?

谢谢:-)

视频

【问题讨论】:

标签: actionscript-3 apache-flex air adobe


【解决方案1】:

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

<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

【讨论】:

  • Gr8 Philarmon,正是我一直在寻找的!感谢十亿!
猜你喜欢
  • 2011-05-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多