我正在创建flex 3组件,当我调整窗口大小时,我需要重新调整标签大小和text.how来做这个吗?
感谢。
答案 0 :(得分:0)
你是否尝试过以百分比表示的宽度和高度?
<mx:Label text="This is my text" width="100%" height="100%"/>
就文本而言,请查看使用here
的技巧 /**
* Cheesy loop to find what should be the font size to fit the text in the inner rectangle
* This is invoked by creationComplete (or whenever you want to resize the font)
*/
private function resize():void {
var tf:TextField = lSpeech.mx_internal::getTextField();
var textFormat:flash.text.TextFormat = tf.getTextFormat();
while( tf.height > height * 0.707 && textFormat.size > 1 && labelFontSize > 1) {
textFormat.size = int( textFormat.size) - 1;
labelFontSize--;
tf.setTextFormat( textFormat);
lSpeech.validateNow();
}
// repsition the label (vertical center)
lSpeech.y = (height - tf.height) / 2 - 10;
lSpeech.height = tf.height;
}