现在的位置: 首页 > 综合 > 正文

Styling the Alert control’s nested buttons

2012年01月15日 ⁄ 综合 ⁄ 共 1535字 ⁄ 字号 评论关闭
The following example shows how you can customize the appearance of the buttons in an Alert control in Flex by setting the buttonStyleName style
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/01/03/styling-the-alert-controls-nested-buttons/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout
="vertical"
        verticalAlign
="middle"
        backgroundColor
="white"
        creationComplete
="init();">

    <mx:Style>
        @font-face {
            src: local("Comic Sans MS");
            fontFamily: myComicSansMS;
            fontWeight: normal;
        }

        Alert {
            buttonStyleName: myCustomButtonStyleName;
        }

        .myCustomButtonStyleName {
            color: red;
            cornerRadius: 12;
            fontFamily: myComicSansMS;
            fontSize: 10;
            fontWeight: normal;
            textDecoration: underline;
            themeColor: red;
        }
    </mx:Style>

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

            private var alert:Alert;

            private function init():void {
                var myMessage:String = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit.\nDonec tincidunt sollicitudin sem.";
                var myTitle:String = "The quick brown fox jumped over the lazy dog";
                alert = Alert.show(myMessage, myTitle);
            }
        ]]>
    
</mx:Script>

    <mx:ApplicationControlBar dock="true">
        
<mx:Button label="Launch alert" click="init();" />
    
</mx:ApplicationControlBar>

</mx:Application>

【上篇】
【下篇】

抱歉!评论已关闭.