1 Reply Latest reply on Jul 16, 2009 3:52 PM by kglad

    displaying array value in dynamic text box

    chinchiheather Level 1

      i defined a global array in the first frame.
      When the user clicks on a button a value is inputted into the array, and they can click on several so all the different values are stored in an array.
      I want to display the last value of the array, so the last button they clicked on, on a separate frame.


      so i define my array like:


      _global.purchases = new Array();


      and the code on my button is:


      on (release){


      and the code on the frame with the text box is:


      var arrayCount = purchases.length;
      var latestValue = arrayCount-1;


      if (purchases[latestValue]=="awhite"){
          imagename_txt = "A White";


      However, the text doesnt display at all. If I trace my array then I get "awhite". If i trace arrayCount I get "6" and "5" for latestValue. But if i try and trace purchases[0] then I get "undefined".
      I'm very confused and would really appreciate any help...