Показать сообщение отдельно
Старый 28.06.2011, 21:06
Wolsh вне форума Посмотреть профиль Отправить личное сообщение для Wolsh Найти все сообщения от Wolsh
  № 8  
Ответить с цитированием
Wolsh
Нуб нубам
 
Аватар для Wolsh

модератор форума
Регистрация: Jan 2006
Адрес: Бердск, НСО
Сообщений: 6,445
UPDATE
Во, кажется нашел решение

Код AS3:
package 
{
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.text.TextField;
    import flash.text.TextFieldAutoSize;
    import flash.text.TextFieldType;
 
    public class Main extends Sprite 
    {
        private var _txt:TextField;
 
        public function Main():void 
        {
            if (stage) init();
            else addEventListener(Event.ADDED_TO_STAGE, init);
        }
 
        private function init(e:Event = null):void 
        {
            removeEventListener(Event.ADDED_TO_STAGE, init);
            // entry point
            _txt = new TextField();
            _txt.type = TextFieldType.INPUT;
            _txt.multiline = true;
            _txt.border = true;
            _txt.width = 50;
            _txt.height = 20;
            _txt.x = 200;
            _txt.y = 150;
            _txt.addEventListener(Event.CHANGE, onChange);
            addChild(_txt);
        }
 
        private function onChange(event:Event):void 
        {    
            var placeW:Number = _txt.textWidth + 5;
            var placeH:Number = _txt.textHeight + 4;
            if (_txt.width < placeW) _txt.width = placeW;
            if (_txt.height < placeH) _txt.height = placeH;
            _txt.scrollH = 0;
        }
    }
}
Там прибавляется к ширине не 4 а 5 - это для того чтобы всеже был виден мигающий курсор каретки. Можно прибавить и больше для.. надежности.. Секрет – в _txt.scrollH = 0;
__________________
Reality.getBounds(this);


Последний раз редактировалось Wolsh; 28.06.2011 в 23:36.