可以設置在TLFTextField上顯示的最大線數?所以我有一個文本比我不想在整個文本上顯示,只有3個第一行可見。我該如何配置?Flash - 在TLFTextField上設置最大線數
這是我還沒有:
var myTLFTextField:TLFTextField = new TLFTextField();
addChild(myTLFTextField);
myTLFTextField.x = 0;
myTLFTextField.y = 0;
myTLFTextField.width = _width
myTLFTextField.height = 100;
myTLFTextField.multiline = true;
myTLFTextField.wordWrap = true;
var myFormat:TextLayoutFormat = new TextLayoutFormat();
myFormat.color = 0x336633;
myFormat.fontFamily = "Arial, Helvetica, _sans";
myFormat.fontSize = 24;
myFormat.textAlign = TextAlign.LEFT;
var textFlow:TextFlow = myTLFTextField.textFlow;
var p:ParagraphElement = new ParagraphElement();
var span1:SpanElement = new SpanElement();
var span2:SpanElement = new SpanElement();
var inlineGraphicElement:InlineGraphicElement = new InlineGraphicElement();
var textLayoutFormat:TextLayoutFormat = new TextLayoutFormat();
//Add graph
inlineGraphicElement.source = drwCircle();
inlineGraphicElement.float = Float.LEFT;
//Add Text to the spans
span1.text = "You can draw a happy face here ";
span2.text = "if you like.as asdfads ad fas fadsf f asdfsdf asd sdafas dff asd adsf adsf adsf asf sadf asdf dfghjf j fhj fgffg hgfhj fg fgj fg jkb asdljk ljka jlkj asdjfh lajsdfh sd sdf asdfasd fdas asd fa sdfadsf asd adsf ad fadsf adsf ads fads fads f adsf asdf ";
p.fontSize = 16;
p.addChild(inlineGraphicElement);
p.addChild(span1);
p.addChild(span2);
// Add Paragraph to text flow and update controller to display
textFlow.addChild(p);
textFlow.hostFormat = myFormat;
textFlow.flowComposer.updateAllControllers();
感謝您的回答,如果我不需要在我的「文本字段」上使用任何圖像,但是我需要在文本的左側顯示圖像並且文本必須小於圖像,所以你的解決方案也會削減我的形象。但是我想我發現了一個使用TruncationOptions的解決方案(我剛剛在幾個小時前發現它),當我解決了我將發佈我的解決方案。謝謝無論如何,這將有助於其他情況:) – 2013-03-07 10:33:57
很好,很高興你有它的工作!請張貼您的解決方案以及TruncationOptions的參考,我從來沒有使用它! – danii 2013-03-07 11:43:08