1 Reply Latest reply on Nov 8, 2007 1:11 PM by Greg Dove

    Help with Text File ActionScript

    ndisdabest
      All --

      Basically, I'm trying to load in a text file that contains multiple variables. The first variable in the text file is "i" which is always equal to a number. That number is used to help me generate a loop and load in the other variables contained within my text file. Eventually, this will be used to rotate through several SWF files using loadMovie, but I've hit a bit of a snag. Can someone take a look at this code and tell me why I keep receiving "undefined" when I try to trace my variables? I can't trace "i" without getting undefined, and I definitely can't trace any of my other variables. That said, it seems like I'm getting the proper number of "undefined" messages to indicate that my loop is working, so I guess that's a plus.

      Also, here are the contents of my headerRotator.txt file:

      i=2&header1=test1.swf&header2=test2.swf

      Code below:
        • 1. Help with Text File ActionScript
          Greg Dove Level 4
          this.header[ i ] can't work when referring to a LoadVars variable that's been loaded. That will be undefined. Did you mean to suffix the variable names with the number? e.g:
          this["header"+i ]

          I'm assuming that header is an array you've declared somewhere else.

          for good measure, I'd also do this:
          instead of :
          i=this.i;

          do:
          i=Number(this.i);