[英]how to change background color of PopUp window in flex
I have developed a application where it contains few PopUp windows. 我开发了一个包含几个PopUp窗口的应用程序。 whenever popup comes the background of the popup is little brighter, is there any way that i can make PopUP Background little darker.
每当弹出窗口出现时,弹出窗口的背景就会变亮一点,有什么方法可以使PopUP背景变暗一些。
Thanks in Advance.. 提前致谢..
If you mean the Alert component, you can do something like this: 如果您是指Alert组件,则可以执行以下操作:
<?xml version="1.0" encoding="utf-8"?>
<s: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" minWidth="955" minHeight="600"
creationComplete="Alert.show('Hello!')">
<fx:Style>
@namespace s "library://ns.adobe.com/flex/spark";
@namespace mx "library://ns.adobe.com/flex/mx";
mx|Alert {
backgroundAlpha: 0.4;
backgroundColor: #00ff00;
}
</fx:Style>
<fx:Script>
<![CDATA[
import mx.controls.Alert;
]]>
</fx:Script>
</s:Application>
//the result //结果
//EDIT //编辑
If you want to use a custom component, it can look like this: 如果要使用自定义组件,它可能如下所示:
//MyAlert.mxml //MyAlert.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:TitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" width="175" height="100">
<fx:Script>
<![CDATA[
import mx.managers.PopUpManager;
protected function onOkClick(event:MouseEvent):void
{
PopUpManager.removePopUp(this);
}
]]>
</fx:Script>
<s:Rect top="0" bottom="0" left="0" right="0">
<s:fill>
<s:SolidColor color="0x00ff00" alpha="0.4"/>
</s:fill>
</s:Rect>
<s:VGroup horizontalAlign="center" width="100%" height="100%">
<s:Spacer height="10"/>
<s:Label text="Hello!"/>
<s:Button label="Ok" click="onOkClick(event)"/>
</s:VGroup>
</s:TitleWindow>
call it from the application: 从应用程序中调用它:
var myAlert:MyAlert = new MyAlert();
PopUpManager.addPopUp(myAlert, this, true);
PopUpManager.centerPopUp(myAlert);
//the result //结果
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.