有誰知道是否有辦法在TextLayout類中查找文本的高度?查找TextLayout組件的文本高度
:我將我的TextLayout對象,像這樣:
this._textFlow = new TextFlow();
this._paragraphElement = new ParagraphElement();
this._textFlow.addChild(this._paragraphElement);
this._span = new SpanElement();
this._span.text = this._text;
this._paragraphElement.addChild(this._span);
if(this._textAlign != ''){
this._paragraphElement.textAlign = this._textAlign;
}
var tempTextWidth:Number;
var tempTextHeight:Number;
if(this._textWidth > 0){
tempTextWidth = this._textWidth;
} else {
tempTextWidth = NaN;
}
if(this._textHeight > 0){
tempTextHeight = this._textHeight;
} else {
tempTextHeight = NaN;
}
this._containerController = new ContainerController(this, tempTextWidth, tempTextHeight);
this._textFlow.flowComposer.addController(this._containerController);
this._textFlow.flowComposer.updateAllControllers();
所有我希望找到的高度公共屬性未定義如this._textFlow.lineHeight。
謝謝,
克里斯
在與高度相關的屬性獲取值之前,可能需要顯示一次。 – 2012-02-07 20:52:17