dcsimg
A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Any tips on this?

Threaded View

  1. #1
    Member
    Join Date
    Sep 2014
    Posts
    77

    Any tips on this?

    Hello All,

    I have written this function:

    PHP Code:
    xd = [4815241561167];
    yd = [2267666];
    var 
    space = new Array();
    space prepare_Space_Array(xd);
    //
    for (var 0i<=xd.length-1i++) {
        
    trace(xd[i]+space[i]+yd[i]);
    }
    //
    function prepare_Space_Array(passedArray:Array) {
        
    //
        //the output is an array (spaceArray) contains space/separator.
        //
        
    var array_Contains_Length_passedArray_Elements:Array = new Array();
        var 
    diffSpace = new Array();
        var 
    spaceArray = new Array();
        var 
    longestSpace:Number 0;
        var 
    generalSpace:String "          ";
        
    //
        
    for (var 0i<=passedArray.length-1i++) {
            
    array_Contains_Length_passedArray_Elements.push(String(passedArray[i]).length);
            if (
    String(passedArray[i]).length>=longestSpace) {
                
    longestSpace String(passedArray[i]).length;
            }
        }
        
    //
        
    for (var 0i<=passedArray.length-1i++) {
            
    diffSpace.push(longestSpace-array_Contains_Length_passedArray_Elements[i]);
        }
        
    trace(diffSpace);
        
    //
        
    for (var 0i<=diffSpace.length-1i++) {
            var 
    space:String " ";
            for (var 
    0j<=diffSpace[i]; j++) {
                
    space " "+space;
            }
            
    space space+generalSpace;
            
    spaceArray.push(space);
        }
        
    //
        
    return spaceArray;
        
    //

    It is all about printing out data as two columns, the column on the right is left-aligned. What I mean here is that the printed data will be as following in the trace window:
    PHP Code:
    48                    226
    1524156116            7
    7                     666 
    As intended to be. However, when copy-&-paste or writing (using other software) this output in a text file it become as the following:
    PHP Code:
    48                            226
    1524156116               7
    7                             666 
    Any tips to follow? Thanks!
    Last edited by Dr_flash; 01-08-2016 at 09:29 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center