A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [RESOLVED] Simple for loop poser.

  1. #1
    Juvenile Delinquent CVO Chris's Avatar
    Join Date
    Jul 2002
    Location
    Ulster, UK
    Posts
    520

    resolved [RESOLVED] Simple for loop poser.

    Simple question. I'm looping through the for loop below:
    PHP Code:
    function LoadXML(e:Event):void {
        
    xmlData=new XML(e.target.data);

        for (var 
    i:int 0xmlData.tab.length(); i++) {
            
    tab(i).text=xmlData.tab[i].@title;
        }

    I have dynamic text fields named tab0, tab1, tab2 etc.

    Where it says tab(i) in the code I want it to say "tab" and then the iteration. So the first time the loop fires i=0 so it would be:
    tab0.text=xmlData.tab[0].@title;
    the second time i=1 so it would be:
    tab1.text=xmlData.tab[1].@title;
    the third i=2 so it would be:
    tab2.text=xmlData.tab[2].@title;
    and so on.

    I've tried various ways of getting the i value in there which didn't work. Any ideas?
    Last edited by CVO Chris; 09-13-2010 at 05:43 PM.

  2. #2
    Senior Member
    Join Date
    Jan 2009
    Posts
    208
    TextField(getChildByName("tab" + i)).text = xmlData.tab[i].@title;

  3. #3
    Juvenile Delinquent CVO Chris's Avatar
    Join Date
    Jul 2002
    Location
    Ulster, UK
    Posts
    520
    Thanks!

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