Reply LinkBack Thread Tools Search this Thread
Old 05-11-2005, 00:05   #1 (permalink)
d3mcfadden
Senior Member
 
d3mcfadden's Avatar
 
Join Date: Apr 2005
Location: -
Posts: 694
Send a message via AIM to d3mcfadden
dynamically refering to a text field

anybody know how i could make this work
Code:
for(i=0; i<array.length; i++) { if(array[i] == undefined) { trace("found and undefined title") textField [i]_txt.text = "there is no title for this"; } else { textField [i]_txt.text = array[i].attributes.title; } }

The Highlighted parts are what I am trying to figure out... I have those text fields predefined on the stage (textField0_txt, textField1_txt..ect) and want to refer to them dynamically in this loop. Can you do this? Thanks any other suggestions would be appreciated.

Last edited by d3mcfadden : 07-11-2005 at 11:29.
  Reply With Quote
Old 08-11-2005, 00:30   #2 (permalink)
d3mcfadden
Senior Member
 
d3mcfadden's Avatar
 
Join Date: Apr 2005
Location: -
Posts: 694
Send a message via AIM to d3mcfadden
anyone???
  Reply With Quote
Old 08-11-2005, 04:17   #3 (permalink)
gray
i still want paying
 
gray's Avatar
 
Join Date: Oct 2003
Location: newcastle, uk
Posts: 4,728
Quote:
textField [i]

why the space?
  Reply With Quote
Old 08-11-2005, 08:44   #4 (permalink)
dan
Iris Folder
 
dan's Avatar
 
Join Date: Apr 2003
Location: smokey
Posts: 2,674
Code:
textField [i]_txt.text = "there is no title for this";

should be something like

Code:
this ["textField" + i + "_txt"].text = "there is no title for this";

don't know about the targeting though, it's your path statement that's wrong
  Reply With Quote
Old 08-11-2005, 15:30   #5 (permalink)
d3mcfadden
Senior Member
 
d3mcfadden's Avatar
 
Join Date: Apr 2005
Location: -
Posts: 694
Send a message via AIM to d3mcfadden
sorted: if anybody is interested in this code. its pretty damn handy when filling text boxed from a XML file

Code:
for(i=0; i<5; i++) { _root["textBox"+i+"_txt"].text="this is text box "+i; }
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8