Flex Multiline Label


/ Published in: Other
Save to your folder(s)



Copy this code and paste it in your HTML
  1. package components
  2. {
  3. import mx.core.UITextField;
  4. import flash.text.TextFieldAutoSize;
  5. import mx.controls.Label;
  6. import flash.display.DisplayObject;
  7.  
  8. public class MultiLineLabel extends Label
  9. {
  10.  
  11. override protected function createChildren() : void
  12. {
  13. // Create a UITextField to display the label.
  14. if (!textField)
  15. {
  16. textField = new UITextField();
  17. textField.styleName = this;
  18. addChild(DisplayObject(textField));
  19. }
  20. super.createChildren();
  21. textField.multiline = true;
  22. textField.wordWrap = true;
  23. textField.autoSize = TextFieldAutoSize.LEFT;
  24. }
  25. }
  26. }
  27.  

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.