A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Array and For loop

  1. #1
    Junior Member
    Join Date
    Aug 2000
    Location
    Italy
    Posts
    10

    Array and For loop

    I have these datas on a .txt file
    PHP Code:
    &d1979=r001,
    &
    d1980=o001,
    &
    d1981=a001,
    &
    d1984=o002,o003,r002,
    &
    d1985=o004,o005,o006,o007,o008,o009,r003,

    ...
    etc etc
    i transform them in array
    PHP Code:
    var a1984 d1984.split(",");
    a1984.pop(); 
    But i have a lot of these datas, so i try to make a for cycle

    PHP Code:
    for (var 1979i<=2005i++) {
        
    xxx "d"+i;
        
    yyy "a"+i;
        var 
    yyy xxx.split(",");
        
    yyy.pop();

    but doesn't work.
    for example, when i=4 i have xxx=d1984, flash don't see it like the d1984 of .txt file.
    if i wr0te:
    trace (xxx)
    inside for cycle, i have d1979, not o002,o003,r002,

    sorry for my english

  2. #2
    Senior Member chi-styler's Avatar
    Join Date
    Jul 2001
    Location
    Bristol, UK
    Posts
    1,237
    Try this
    Code:
    for (var i = 1979; i<=2005; i++) {
        this["a" + i] = this["d" + i].split(",");
        this["a" + i].pop();
    }

  3. #3
    Junior Member
    Join Date
    Aug 2000
    Location
    Italy
    Posts
    10
    thank you chi-styler... i'm happy now!

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