flex mx组件和s组件的字体兼容性不一致

本文介绍了一个使用Adobe Flex创建的应用程序,该程序通过按钮点击事件来改变Label组件的字体样式,包括宋体、黑体、仿宋、楷体和微软雅黑。这为用户提供了字体选择的灵活性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<?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" minWidth="955" minHeight="600">  
    
    
    <fx:Script>  
        <![CDATA[ 
            protected function button1_clickHandler(event:MouseEvent):void 
            { 
                // TODO Auto-generated method stub 
                this.lbText.setStyle("fontFamily", "SimSun"); 
                this.lbText1.setStyle("fontFamily", "SimSun"); 
            } 
            
            protected function button2_clickHandler(event:MouseEvent):void 
            { 
                // TODO Auto-generated method stub 
                this.lbText.setStyle("fontFamily", "SimHei"); 
                this.lbText.setStyle("fontFamily", "SimHei"); 
            } 
            
            
            protected function button3_clickHandler(event:MouseEvent):void 
            { 
                // TODO Auto-generated method stub 
                this.lbText.setStyle("fontFamily", "FangSong_GB2312"); 
                this.lbText1.setStyle("fontFamily", "FangSong_GB2312"); 
            } 
            
            
            protected function button4_clickHandler(event:MouseEvent):void 
            { 
                // TODO Auto-generated method stub 
                this.lbText.setStyle("fontFamily", "KaiTi_GB2312"); 
                this.lbText1.setStyle("fontFamily", "KaiTi_GB2312"); 
            } 
            protected function button5_clickHandler(event:MouseEvent):void 
            { 
                // TODO Auto-generated method stub 
                this.lbText.setStyle("fontFamily", "微软雅黑"); 
                this.lbText1.setStyle("fontFamily", "微软雅黑"); 
            } 
            
        ]]>  
    </fx:Script>  
    
    <fx:Declarations>  
        <!-- 将非可视元素(例如服务、值对象)放在此处 -->  
    </fx:Declarations>  
    <mx:Label id="lbText" x="96" y="67" text="mx:大同市朔州市忻州市太原市-----良   轻度污染" 
                     fontSize="14" />  
    <s:Label id="lbText1" x="96" y="100" text="s:大同市朔州市忻州市太原市-----良   轻度污染" 
               fontSize="14" />  
    <s:Button  x="4" y="3" label="宋体" click="button1_clickHandler(event)" />  
    <s:Button  x="82" y="3" label="黑体" click="button2_clickHandler(event)"/>  
    <s:Button  x="167" y="3" label="仿宋" click="button3_clickHandler(event)"/>  
    <s:Button  x="245" y="3" label="楷体" click="button4_clickHandler(event)"/>  
    <s:Button  x="350" y="3" label="微软雅黑" click="button5_clickHandler(event)"/>  
</s:Application>  

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值