A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: printing for loop items to text box

  1. #1
    Member
    Join Date
    Apr 2014
    Posts
    63

    printing for loop items to text box

    The trace below shows all 25 items from my xml feed in the list one ontop of each other. Although my text box only shows the first item in the list and nothing else. I checked the text box and it's set to multiple lines. Anyone know what I'm doing wrong and how to have it print a divider and space (/n) between each item when it does print correctly to the text box?

    code:

    function completeHandler(e:Event)
    {

    var san = new XML(e.target.data);
    var NofCamp = san.*.subject.length();
    for(var i:Number = 0; i<NofCamp; i++) {
    var allsub:String = san.*.subject[i].text();
    m_txt.text = allsub;
    trace(allsub);
    }

    }


  2. #2
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    You can use either

    m_txt.text += allsub;

    or

    m_txt.appendText(allsub + "\n");

  3. #3
    Member
    Join Date
    Apr 2014
    Posts
    63
    many thanks once again.

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