`

Flex Button 文字自动换行

阅读更多

 

package 
{ 
    import flash.text.TextFieldAutoSize; 
    import mx.controls.Button; 
 
    public class WrappingButton extends Button 
    { 
 
 
        public function WrappingButton() 
        { 
                super(); 
        } 
 
        override protected function createChildren():void 
        { 
                super.createChildren(); 
 
                textField.multiline = true; 
                textField.wordWrap = true; 
                textField.autoSize = TextFieldAutoSize.CENTER; 
        } 
 
        override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void 
        { 
                super.updateDisplayList(unscaledWidth, unscaledHeight); 
                textField.y = (this.height - textField.height) >> 1; 
 
                height = textField.height + getStyle("paddingTop") + getStyle("paddingBottom"); 
        } 
    } 
} 

  

引用原文:http://stackoverflow.com/questions/1654403/adobe-flex-word-wrap-in-button-label

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics