Показать сообщение отдельно
Старый 26.01.2010, 11:11
Seroy вне форума Посмотреть профиль Отправить личное сообщение для Seroy Найти все сообщения от Seroy
  № 9  
Ответить с цитированием
Seroy

Регистрация: Jun 2008
Адрес: пока еще здесь
Сообщений: 198
Цитата:
Сообщение от mooncar Посмотреть сообщение
Автор, само текстовое поле в компоненте Label имеет имя labelField.
Ему-то и нужно шрифт заэмбедить.
А после этого как-то назначить нужный шрифт и прочее оформление, чтобы заработало.
С textFormat не получилось.
Зато вот получилось с помощью CSS:

Код AS1/AS2:
import TextField.StyleSheet;
var my_styleSheet:StyleSheet = new StyleSheet();
my_styleSheet.setStyle(".mystyle", {color:"#FF0000", fontFamily:"PT Sans Narrow Bold", fontSize:"20"} );
 
my_label.labelField.embedFonts = true;
my_label.labelField.styleSheet = my_styleSheet;
my_label.text = '<span class="mystyle">Это label с внедренным текстом</span>';
Что интересно, с html-форматированием работает именно конструкция my_label.text, а не my_label.labelField.htmlText (интересно, почему).

См. прикрепленный рабочий пример в конце.


А ниже я привел список возможных свойств этого самого текстового поля в Label, полученный с помощью нехитрой операции
Код AS1/AS2:
for (i in my_label.labelField) {
	trace(i + '   ' +  my_label.labelField[i]);
}
Код:
getFocusManager   [type Function]
onKillFocus   [type Function]
onSetFocus   [type Function]
setFocus   [type Function]
changeTextStyleInChildren   [type Function]
setStyle   [type Function]
adjustFocusRect   [type Function]
drawFocus   [type Function]
getPreferredHeight   [type Function]
getPreferredWidth   [type Function]
_getTextFormat   [type Function]
value   
getValue   [type Function]
setValue   [type Function]
__getTextFormat   [type Function]
getStyle   [type Function]
setColor   [type Function]
draw   [type Function]
invalidateStyle   [type Function]
setSize   [type Function]
move   [type Function]
enabled   undefined
visible   true
bottom   NaN
right   NaN
y   0
top   0
x   0
left   0
height   22
width   100
styleSheet   [object Object]
mouseWheelEnabled   true
condenseWhite   false
restrict   null
textHeight   0
textWidth   0
bottomScroll   1
length   0
selectable   false
multiline   false
password   false
wordWrap   false
background   false
border   false
html   false
embedFonts   true
maxChars   null
maxhscroll   0
hscroll   0
variable   null
htmlText   
type   dynamic
text   
autoSize   none
tabIndex   undefined
textColor   0
backgroundColor   16777215
borderColor   0
maxscroll   1
scroll   1
filters   
sharpness   0
thickness   0
antiAliasType   normal
gridFitType   pixel
styleName   _level0.my_label
К этим свойствам и методам тоже можно попробовать пообращаться .
mooncar, спасибо! обяз. сегодня посмотрю. респект!