• 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>

  • 相关阅读:
    53、Gif 控件GifView 的使用,播放gif图片
    52、图片缩放库 PhotoView
    51、自定义View基础和原理
    Adapter适配器 final int Id 导致选中的Item不在当前界面
    Linux目录结构
    Linux包管理工具分析
    Linux 软件包安装管理
    MySQL配置详解
    MySQL 5.5.x配置文件详解
    Linux Apache2 配置介绍
  • 原文地址:https://www.cnblogs.com/taobataoma/p/1089910.html
Copyright © 2020-2023  润新知