LoadVars - getting several variables with for-loop

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • molle
    New Member
    • May 2007
    • 11

    #1

    LoadVars - getting several variables with for-loop

    Hi!

    I have like a 100 names in a database table, I want to get
    them with a LoadVars in actionscript.

    I wonder if there is a way of writing instead of this:

    Code:
    myData = new LoadVars();
    
    myData.onLoad = function() {
     textfield1.text = myData.name1;
     textfield2.text = myData.name2;
     textfield3.text = myData.name3;
     ...
     textfield100.text = myData.name100;
    };
    something mor like this:

    Code:
    myData = new LoadVars();
    myData.onLoad = function() {
     for( i = 1; i < 101; i++){
      this["textfield"+i].text = myData.????;
     }
    };
    I wonder what I can write instead of ???? so I don't need to write
    a 100 lines of code.

    Thx
  • ernieweaselfat
    New Member
    • Feb 2008
    • 1

    #2
    Hi,

    Did you ever figure out how to do this?

    I am looking for the exact same solution.

    Thanks!

    Comment

    Working...