5 Replies Latest reply on Jun 14, 2006 4:53 PM by

    Variables

      var t3 = "Hello world";
      var tn = 't'+_currentframe; //_currentframe now is iqual 3
      trace(tn);

      tn shoud be "Hello world", but I'm getting that tn is equal to t3.

      Thanks in advance
        • 1. Re: Variables
          norbit
          this is the right behavior! tn will be equel to the string "t3" in your example

          i think what you meant to do was -

          var tn - this['t'+this._currentframe]
          1 person found this helpful
          • 2. Re: Variables
            Thanks norbit
            • 3. Re: Variables
              Level 7
              "norbit" <cel@web-engineer.co.uk> wrote in message
              news:e6p884$ss5$1@forums.macromedia.com...
              > var tn - this['t'+this._currentframe]

              Apart from the typo (= not -) .. that would fail if inside a function,
              because you cannot get to local vars (declared with var) using this[]
              notation.

              Better is to use

              var tn = eval('t'++this._currentframe);
              --
              Jeckyl


              • 4. Re: Variables
                I use the code as:

                this.onEnterFrame = function() {
                stop();
                fondo.tema = eval('t'+this._currentframe);
                if (_currentframe == 1) {
                nextback(false, true);
                } else if ((_currentframe == _totalframes)) {
                nextback(true, false);
                } else {
                nextback(true, true);
                }
                };
                • 5. Re: Variables
                  Thanks

                  I use the code as:

                  this.onEnterFrame = function() {
                  stop();
                  fondo.tema = eval('t'+this._currentframe);
                  if (_currentframe == 1) {
                  nextback(false, true);
                  } else if ((_currentframe == _totalframes)) {
                  nextback(true, false);
                  } else {
                  nextback(true, true);
                  }
                  };