Looping through data

Ok I have a question… no idea how complicated this is but here goes:

I have the following script for looping through data that is being returned into flash through a coldfusion page. Page just spits out my variables ie: Summary1=Bill,Summary2=Bob

for (i=1; i<=1; ++i){
&nbsp&nbsp&nbspvar returned = search[“Summary” +i];
&nbsp&nbsp&nbsptrace(returned);
&nbsp&nbsp&nbsp_root.results.text = “Results for your search '” +myData+ “’:” +returned;
}

I have this loop written to process the data and display it in a text area (its a search program).

Now what is happening is that as soon as flash gets goes through this loop it overwrites the first variable, bill and only displays bob. How would i go about displaying both Bill and Bob in the text area?

thanks,

for (i=0; i<=1; ++i){
	var returned = search["Summary" +i];
	trace(returned);
	_root.results.text = "Results for your search '" +myData+ "':" +returned;	
}

pom :asian:

well what I’m really trying to do would look more like this:

for (i=1; i<=5; ++i){
&nbsp&nbsp&nbspvar returned = returned+"-"+search[“Summary” +i];
&nbsp&nbsp&nbsptrace(returned)
}
_root.results.text = “Results for your search '” +myData+ “’:” +returned;

i almost have it working except i dont know how to throw a break in there so the “-” is holding the place for the break.

also I would like to set the 5 to a variable instead of a static number. Any ideas?

-z

Try

for (i=0; i<=5; ++i){
	var returned = search["Summary" +i];
	trace(returned);
	_root.results.text += "Results for your search '" +myData+ "':" +returned;	
}

pom :asian:

That works except for one problem. When the loop executes it updates _root.results.text 5 seprate times and you only get to view the 5th rendering of the code.

with the way that I have done it above it shows up correctly but I would like to insert hard returns instead of the “-” character.

I would also like to setup a variable for the number “5” in “i<=5” but, I know how to do that. How do i tell flash to do a hard return?

thanks,

one of our coldfusion programmers mentioned that too but, didn’t try it yet. I’ll give it a shot.

-z