Advertisement
Guest User

Untitled

a guest
Jun 3rd, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Haxe 0.56 KB | None | 0 0
  1. private function insertBreakLines()
  2.     {
  3.         var saveText = text;
  4.  
  5.         var last = _finalText.length;
  6.         var n0:Int = 0;
  7.         var n1:Int = 0;
  8.  
  9.         while (true)
  10.         {
  11.             last = _finalText.substr(0, last).lastIndexOf(" ");
  12.  
  13.             if (last <= 0)
  14.                 break;
  15.  
  16.             text = prefix + _finalText;
  17.             n0 = textField.numLines;
  18.  
  19.             var nextText = _finalText.substr(0, last) + "\n" + _finalText.substr(last + 1, _finalText.length);
  20.  
  21.             text = prefix + nextText;
  22.             n1 = textField.numLines;
  23.  
  24.             if (n0 == n1)
  25.             {
  26.                 _finalText = nextText;
  27.             }
  28.         }
  29.  
  30.         text = saveText;
  31.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement