宋欢的博客

flash webgame 开发 svn:http://riainsandy.googlecode.com/svn/trunk/

原创 解决textinput没有垂直居中的属性收藏

新一篇: flexchat | 旧一篇: flex调试工具 -- reflexutil

 不知道为什么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
        }

    }

}

发表于 @ 2007年10月31日 16:45:00|评论(loading...)|编辑

新一篇: flexchat | 旧一篇: flex调试工具 -- reflexutil

评论

#沙沙 发表于2008-11-21 14:29:23  IP: 124.93.222.*
这个代码怎么用啊?
#songhuanren 发表于2008-11-21 15:54:27  IP: 58.240.170.*
新建一个类啊。
#沙沙 发表于2008-11-24 11:21:21  IP: 124.93.222.*
小妹愚笨,还是不太会用。
我用的flash,和flex是一样的吗?
发表评论  


登录
Csdn Blog version 3.1a
Copyright © 宋欢