如何弹出一个透明面板,在 Flex 4 中单击外部时该面板将被关闭
我需要在 Flex 4 中弹出一些按钮。用户应该能够看到按钮周围和按钮之间的背景(最好有点褪色,但并不重要)。单击除按钮之外的任何位置都应该将其全部关闭。
因此,我创建了一个 Spark Panel
并添加了一个带有一些按钮的 Spark VGroup
。然后我称
PopupManager.addPopUp(myNewPanel, background, true);
我的两个主要问题是面板不透明并且单击按钮外部不会将其关闭...我该如何实现呢?
更新:弄清楚如何在单击面板外部时关闭弹出窗口:
addEventListener("mouseDownOutside", close);
private function close(event:FlexMouseEvent):void {
PopUpManager.removePopUp(this);
}
现在我只需要弄清楚如何使面板透明,以便您可以看到周围的背景以及按钮之间。
I need to popup some buttons in Flex 4. Users should be able to see the background (ideally a little faded, but not important) around and in between the buttons. And clicking anywhere except the buttons should dismiss them all.
So I created a spark Panel
and added a spark VGroup
with some buttons. Then I call
PopupManager.addPopUp(myNewPanel, background, true);
My 2 main problems are the panel is not transparent and clicking outside the buttons doesn't dismiss them... How do I implement that?
UPDATE: Figured out how to dismiss the popup when clicking outside the panel with:
addEventListener("mouseDownOutside", close);
private function close(event:FlexMouseEvent):void {
PopUpManager.removePopUp(this);
}
Now I just need to figure out how to make the Panel transparent so you can see the background around and in between the buttons.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该使用 FlexMouseEvent.MOUSE_DOWN_OUTSIDE 而不是字符串“mouseDownOutside”。代码完成、编译时检查,让其他人更容易阅读您的代码。
对于背景,您可以使用 css 对其进行样式设置。下面是 Spark 面板的所有 css 属性的列表 - http: //docs.huihoo.com/flex/4/spark/components/Panel.html#styleSummary
You should use FlexMouseEvent.MOUSE_DOWN_OUTSIDE instead of the string "mouseDownOutside". Code completion, compile-time checking and makes it easier for others to read your code.
For the background, you can use css to style it. Heres a list of all the css properties for a spark panel - http://docs.huihoo.com/flex/4/spark/components/Panel.html#styleSummary