3 Replies Latest reply on Oct 13, 2006 7:04 AM by Sarford

    Target an Array with a variable

    Sarford Level 1
      Hi all,

      I have this small problem. I want to use a variable to target an Array, but I propably have my code wrong cause all I get is 'undefined'.
      In the root I have an array called jabber:

      root timeline frame 1 actions:

      var jabber:Array = new Array ("twee","drie","vier","vijf");

      On the stage I have a button with this actionscript:

      on (release) {
      _global.temp2 = "00";
      var temp:Number = int(_global.temp2)
      var temp2:String = "jabber";
      trace (temp2[temp]);
      }

      _global.temp2 can change to change the index, but I also want to be able to change temp2 to target another array.
      Is this possible? What am I doing wrong?

      thanks for your time,

      Simon