解决textinput没有垂直居中的属性

 不知道为什么textinput一直没有垂直居中的属性.于是就自己写了个类,支持垂直居中 :

 

package  com.sandy.global.view.component.textinput
{
    
import mx.controls.Text;
    
import mx.controls.TextInput;
    
    
public class VerticalMiddleTextInput extends TextInput
    
{
        
public function VerticalMiddleTextInput()
        
{
            
super()
        }

        
        override 
protected function createChildren():void
        
{
            
super.createChildren();
        }

        
        override 
protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
        
{
            
super.updateDisplayList( unscaledWidth, unscaledHeight );
            
            
this.textField.height = this.textField.textHeight ;
            
            
this.textField.y = this.height/2 -this.textField.height/2
        }

    }

}

你可能感兴趣的:(解决textinput没有垂直居中的属性)