Jul 21

接下来的例子演示了Flex中如何通过CSS设置modalTransparencyBlur, modalTransparency, modalTransparencyColormodalTransparencyDuration样式,改变一个modal Alert控件模糊度,透明度以及其颜色。

让我们先来看一下Demo可以右键View Source或点击这里察看源代码):


下面是完整代码(或点击这里察看):

Download: main.mxml
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
  3.         layout="vertical"
  4.         verticalAlign="middle"
  5.         backgroundColor="white"
  6.         creationComplete="showAlert()">
  7.  
  8.     <mx:Style>
  9.         Alert {
  10.             modalTransparencyBlur: 5;
  11.             modalTransparency: 0.6;
  12.             modalTransparencyColor: #FF0000;
  13.             modalTransparencyDuration: 1000;
  14.         }
  15.     </mx:Style>
  16.  
  17.     <mx:Script>
  18.         <![CDATA[
  19.             import mx.controls.Alert;
  20.  
  21.             private var a:Alert;
  22.  
  23.             private function showAlert():void {
  24.                 a = Alert.show("text", "title", Alert.OK);
  25.             }
  26.         ]]>
  27.     </mx:Script>
  28.  
  29.     <mx:Button label="Show Alert" click="showAlert()" />
  30.  
  31. </mx:Application>
代码:Peter deHaan 翻译/整理/编译:minidxer

written by Minidxer  |  tags: , ,

Related Post

Leave a Reply