2010-05-11 42 views

回答

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; 
    } 
+0

谢谢你,我没有得到一个解决方案中,VBOX里面我把一个标签和文本和图像图像正确缩小,但文本和标签不会缩小我的标签和文本宽度,height =“100”。要做什么?还有其他建议? – aravinda 2010-05-12 06:22:55