A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: array in textfield

  1. #1
    Member
    Join Date
    Apr 2009
    Posts
    34

    array in textfield

    hey

    i have a quiz and i want to add the final results in a text field. First i have an array which i push the score to. now i need to know how to put that array in to a text field. i have this code -
    code:

    for (var s:int = 0; s<arrscore.length; s++)
    {
    score_txt.text = (arrscore[s]);
    }



    but it just puts the latest score into the textfield. so if i get 3 it puts in 3 and if anyone does it again it puts their score in instead of mine. i want it to show all the different results in the texfield on an individual line

  2. #2
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    You want appendText - that will add on to the existing content rather than replacing.

    PHP Code:
    score_txt.appendText(arrscore[s] + ", "); 
    Also, if the display isn't that important you could just put the entire array in at once:

    PHP Code:
    score_txt.text arrscore.toString(); 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center