Relax Breath of Solution.Community tech blog of Sameera Thilakasiri - Consultant UI, UX, RWD Specialist/ Interactive Designer

Just I wanted.. Do you?…

MultiLine Label in Flex

Posted on September 28, 2010 | Comments Off on MultiLine Label in Flex

If you are using the control and the size of your text is bigger than the size of the container, you will see a cut off version of the text because by default, the Label control does not allow multiline text.

So, here is what I wrote quickly to achieve this functionality.

package   components
{
 import mx.core.UITextField;
 import flash.text.TextFieldAutoSize;
         import   mx.controls.Label;
   import flash.display.DisplayObject;

   public class MultiLineLabel extends Label
 {

   override protected function createChildren() : void
 {
 //   Create a UITextField to <a href="http://blogtorn.com/images/">where do you buy viagra | buy cialis phentermine | cheap levitra online</a>  display the   label.
 <a   href="http://amoxil-pharm.net">buy penicillin</a>  if (!textField)
 {
 textField = new UITextField();
 textField.styleName         = this;
 addChild(DisplayObject(textField));
     }
 super.createChildren();
   textField.multiline   = true;
 textField.wordWrap = true;
 textField.autoSize   = TextFieldAutoSize.LEFT;
 }
 }
}


Author
Sameera Thilakasiri By Sameera Thilakasiri
,is a front-end developer based in Colombo, is a blogger and a lifestyle photographer.
Follow him Twitter and Google+. Check out him.

Comments

Comments are closed.