1 Reply Latest reply on Nov 3, 2007 5:46 PM by BSpero

    Displaying array in text box

    Level 1
      I'm trying to bring in variables from a remote shared object and add them to an array and display those values on stage either in a dynamic textbox as a variable or using myTextBox.text. I'm able to pass the values into the swf via the RSO no problem, but where I'm running into trouble is getting the entire array to show in the textbox. All I'm getting is the last item that was added to the array....

      var rec_array:Array = new Array();

      remote_so.theseCredits = function(someName, credits)
      userName = someName
      theseCredits = credits


      displayArray = function(){
      rec_array.push({name: userName, Credits: theseCredits});
      for(i=0; i<rec_array.length; i++){
      _root.userCredits.CLIST =(rec_array .name + ", " + rec_array.Credits);

      I know there's an easy solution to this I just can't see the forest for the proverbial trees right now!...

      Thanks in advance
        • 1. Re: Displaying array in text box
          BSpero Level 1
          From what it looks like, you keep setting the text box to each item in the array, but instead of adding it to the box, it replaces the contents. I am not totally sure, because I don't know how you are setting the text box, but if you are trying to set _root.userCredits.CLIST, then that line should read something like...

          _root.userCredits.CLIST = _root.userCredits.CLIST+(rec_array.name + ", " + rec_array.Credits);

          The way you have it now, when it does it one at a time, it puts the last item in last, so that is what is left. This is my guess from your code, not having the rest of the scripts.