Show
Ignore:
Timestamp:
06/06/08 10:11:42 (18 months ago)
Author:
jeroen
Message:

implemented stacker; display of media and some controlbaritems still broken

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/as3/com/jeroenwijering/utils/Strings.as

    r1 r4  
    99 
    1010public class Strings { 
    11  
    12  
    13         /**  
    14         * Fit string in a certain textbox, keeping full words.  
    15         *  
    16         * @param str    The string to chop. 
    17         * @param fld    The textfield the string should fit into. 
    18         **/ 
    19         public static function fit(str:String,fld:TextField):String { 
    20                 var wid = fld.width; 
    21                 var lns = Math.round(fld.height/18); 
    22                 var mxm = Math.round(wid*lns/6)-5; 
    23                 if(str.length < mxm || str.indexOf(" ",mxm) == -1) {  
    24                         return str; 
    25                 } else { 
    26                         return str.substr(0,str.indexOf(" ",mxm)) + ' ..'; 
    27                 } 
    28         }; 
    2911 
    3012