Styling Alert controls in Flex using the StyleManager class and setStyle() methods

简介:
The following example shows how you can style a Flex Alert control using the static  StyleManager.getStyleDeclaration()  method, and the  setStyle()  method
<? xml version="1.0" encoding="utf-8" ?>
<!--  http://blog.flexexamples.com/2008/02/29/styling-alert-controls-in-flex-using-the-stylemanager-class-and-setstyle-methods/  -->
< mx:Application  xmlns:mx ="http://www.adobe.com/2006/mxml"
        layout
="vertical"
        verticalAlign
="middle"
        backgroundColor
="white"
        creationComplete
="init();" >

    
< mx:Script >
        
<![CDATA[
            import mx.controls.Alert;
            import mx.styles.StyleManager;

            private var alert:Alert;
            private var alertCSS:CSSStyleDeclaration;

            private function init():void {
                alertCSS = StyleManager.getStyleDeclaration("Alert");
            }

            private function showAlert(color:Object):void {
                alertCSS.setStyle("modalTransparencyColor", color);
                alertCSS.setStyle("themeColor", color);
                alert = Alert.show("The quick brown fox");
            }
        
]]>
    
</ mx:Script >

    
< mx:ApplicationControlBar  dock ="true" >
        
< mx:Button  label ="Red"
                themeColor
="red"
                click
="showAlert('red');"   />
        
< mx:Button  label ="Orange"
                themeColor
="haloOrange"
                click
="showAlert('haloOrange');"   />
        
< mx:Button  label ="Yellow"
                themeColor
="yellow"
                click
="showAlert('yellow');"   />
        
< mx:Button  label ="Green"
                themeColor
="haloGreen"
                click
="showAlert('haloGreen');"   />
        
< mx:Button  label ="Blue"
                themeColor
="haloBlue"
                click
="showAlert('haloBlue');"   />
    
</ mx:ApplicationControlBar >

</ mx:Application >




    本文转自 OldHawk  博客园博客,原文链接:http://www.cnblogs.com/taobataoma/archive/2008/03/04/1089910.html,如需转载请自行联系原作者



相关文章
|
3月前
|
开发工具 git
Stylelint—— Expected class selector ".nut-popup--top" to be kebab-case selector-class-pattern
新项目制定规范接入了stylelint,并通过husky在git提交时去触发检测修复,因为使用的是NutUi,所以无法直接调整组件对应的类名称,只好在stylelint.config.js中加入相应的rules进行配置。
104 0
|
6月前
|
前端开发
|
6月前
使用Form报错提示If ngModel is used within a form tag, either the name attribute must be set or the form
使用Form报错提示If ngModel is used within a form tag, either the name attribute must be set or the form
|
JavaScript
Element UI报错:Unknown custom element: <el-menu>
Element UI报错:Unknown custom element: <el-menu>
171 0
|
开发框架 前端开发 .NET