Показать сообщение отдельно
Старый 11.01.2007, 04:08
Nirth вне форума Посмотреть профиль Отправить личное сообщение для Nirth Посетить домашнюю страницу Nirth Найти все сообщения от Nirth
  № 8  
Ответить с цитированием
Nirth
4AM Games
 
Аватар для Nirth

блогер
Регистрация: Nov 2002
Адрес: Sofia
Сообщений: 6,264
Записей в блоге: 1
Отправить сообщение для Nirth с помощью ICQ Отправить сообщение для Nirth с помощью AIM Отправить сообщение для Nirth с помощью MSN Отправить сообщение для Nirth с помощью Yahoo Отправить сообщение для Nirth с помощью Skype™
Код:
package eu.orangeflash.controls
{
	import mx.controls.LinkButton;
	import mx.controls.Button;
	import mx.core.UIComponent

	import flash.text.TextField
	import mx.core.mx_internal;;

	public class MultilineLink extends LinkButton
	{		
		public function MultilineLink()
		{
		}
		
		protected override function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
		{
			super.updateDisplayList(unscaledWidth, unscaledHeight);
			
			var h:Number = calculateMultilineHeight(label);
			
			textField.height = h;
			textField.y		 = (height-h)/2;
		}
		
		
		
		protected override function measure():void
		{
			super.measure();
			
			var textHeight:Number = 8;
			
			if(label)
			{
				textHeight += calculateMultilineHeight(label);
			}
			
			mx_internal::viewIcon();
			mx_internal::viewSkin();
			
			var iconHeight:Number = mx_internal::currentIcon ? mx_internal::currentIcon.height : 0;
			
			var h:Number = 0;
			
			if (labelPlacement == "left" ||
			labelPlacement == "right")
			{
				h = Math.max(textHeight, iconHeight);
			}
			else
			{
				if (label && label.length > 0)
					h = textHeight + iconHeight;
				else
					h = iconHeight;
				if (iconHeight != 0)
					h += getStyle("verticalGap");
			}
			trace(textField.x);
			this.measuredMinHeight = this.measuredHeight = h;
			textField.y = (h - textHeight)/2;
		}
		
		protected function calculateMultilineHeight(multilineText:String):Number
		{
			var tf:TextField = new TextField();
				tf.autoSize  = "left";
				tf.text      = multilineText;
			
			return tf.height;
		}
	}
}
__________________
Я перестал переписывать, начал редактировать, еще лет 15 и я стану писателем ^_^