自定义Alert样式

c.mxml

 

<?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"
      xmlns:view="*"
      minWidth="955" minHeight="600">
 <fx:Style>
  @namespace mx "library://ns.adobe.com/flex/mx";
  .alertMessage{
   fontSize:14;
   fontFamily:宋体;
   color:#228A11;
  }
  
  .alertButton {            
   fontSize: 13;
   fillAlphas: 1.0, 1.0;
   fillColors: #FFFFFF, #BAE0F9;
  }
  
  .alertTitle{
   fontSize: 13;
   color:#ffffff;
   fontWeight:bold;            
  }
  mx|Alert{
   backgroundColor:#FFFFFF;
   backgroundAlpha: 1.0;
   color: #323232;
   borderColor: #7CBCEC;            
   
   headerHeight:30;
   
   headerColors:#7CBCEC,#2C56B3;            
   dropShadowColor:#7CBCEC;
   themeColor: #7CBCEC;
   /* window backgroud except the alert window*/
   modalTransparencyColor: #ffffff;
   
   dropShadowEnable:true;
   
   borderThicknessLeft:1;
   borderThicknessRight:1;
   borderThicknessBottom:0;
   
   paddingBottom: 20;            
   
   messageStyleName:alertMessage;
   titleStyleName:alertTitle;
   buttonStyleName: alertButton;     
  }    

  
 </fx:Style>
 <view:d id="ddsfd">
  
 </view:d>
</s:Application>

 

d.mxml

 

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas 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="400" height="300">
 
 <fx:Script>
  <![CDATA[
   import mx.controls.Alert;
   protected function button1_clickHandler(event:MouseEvent):void
   {
    // TODO Auto-generated method stub
    Alert.show("提示","确认点击");   
   }
  ]]>
 </fx:Script>
 

 
 <s:Button label="按钮" click="button1_clickHandler(event)">
  
 </s:Button>
</mx:Canvas>

你可能感兴趣的:(自定义Alert样式)