setting text property of the textfield in a loop

  • glass
  • Born
  • Born
  • glass
  • Posts: 3

Post 3+ Months Ago

Hello

Could anybody please let me know how to dinamically write text to a series of textboxes. The textboxes are ‘inside a movieclip object which are stored in an array. It works for individual text box e.g.

Mc1.text1.text = “abc”
Mc1 is the movie clip’s name, text1 is the textboxes’ name

if I try to acces the textboxes in a for loop I cannot set the name of the text box:

Code: [ Select ]
for (var i=0; i<mc_array.length; i++){
    var no = i+1;
    mc_array[i].text+no.text = “abc”;
}
  1. for (var i=0; i<mc_array.length; i++){
  2.     var no = i+1;
  3.     mc_array[i].text+no.text = “abc”;
  4. }


This code does nothing at all!

Please help – othervise I will have to set all of the tex boxes individually – and I’ve got quite a few of them!

Thanks,

glass
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • lostinbeta
  • Guru
  • Guru
  • User avatar
  • Posts: 1402
  • Loc: Philadelphia, PA

Post 3+ Months Ago

Your targetting is wrong. You will need to use what is called Associative Array Referencing... you can read more on that here....

http://www.kirupaforum.com/forums/showt ... adid=12082
  • meAsking
  • Beginner
  • Beginner
  • meAsking
  • Posts: 38

Post 3+ Months Ago

works!

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 32 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.