Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dynamic data exchange --Please Help!

Status
Not open for further replies.

2cxc

Programmer
Aug 29, 2003
245
CA
Hello, I have a list box (named "myName") on the main stage with items in it, there is also a dynamic text box named "display". I'm trying to select an item in the list box and have the dynamic text box display database values relating to that item. I'm using ASP and have the server side aspect done. The ASP page takes write a variable string to send back to Flash and then the response.write sends the name and value pairs to the page so flash can get them.

The flash movie is just 1 frame and i have these actions on it own layer

Code:
myName.setChangeHandler("myHandler");
//Custom handler for myName
//This handler is called each time selection is
//changed.
myHandler = function (component) {
	myVars = new LoadVars();
	myVars.curName = myName.getSelectedIndex()+1;
	myVars.onLoad = displayInfo;
	myVars.sendAndLoad("wpg.asp", myVars);
};

//Extracts db info and displays it using HTML
displayInfo = function () {
	display.htmlText = "";
	myTotal = this["total"];
	if (myTotal != 0) {
		display.htmlText += &quot;<font color=\&quot;#999999\&quot; size=\&quot;11\&quot;><b>There are <font color=\&quot;#CC6600\&quot;><i>&quot;+myTotal+&quot;</i></font> entries for this month</b></font><br>&quot;;
		for (var i = 0; i<this[&quot;total&quot;]; i++) {
			display.htmlText += &quot;<font color=\&quot;#CC6600\&quot; size=\&quot;11\&quot;><b>&quot;+this[&quot;myName&quot;+i]+&quot;</b></font><br>&quot;;
			display.htmlText += &quot;<font size=\&quot;11\&quot;><b>&quot;+this[&quot;myAddress&quot;+i]+&quot;</b></font><br>&quot;;
			display.htmlText += &quot;<font size=\&quot;11\&quot;>&quot;+this[&quot;myPhone&quot;+i]+&quot;</font><br><br>&quot;;
		}
	} else {
		display.htmlText += &quot;<b>No Entries.</b>&quot;;
	}		
};

I've tried to fool around with this and the else statement (&quot;No Entries.&quot;) is the only thing i can get to display. Any ideas why this may be?? Please Help

Here's part of the ASP code:
Code:
Dim curName, responseVars, counter
curName = Request (&quot;curName&quot;)
counter = 0
Set connDB = Server.CreateObject(&quot;ADODB.Connection&quot;)
connDB.Open &quot;DBQ=&quot; & Server.MapPath(&quot;\menu\wegmnu.mdb&quot;) & &quot;;&quot; & _
&quot;DRIVER=Microsoft Access Driver (*.mdb)&quot;
sql = &quot;SELECT * FROM rerans WHERE [name] = '&quot;&curName&&quot;'&quot; 
Set rs = connDB.Execute(sql)
while not rs.eof
	responseVars = responseVars & &quot;name&quot;  & counter &  &quot;=&quot; & rs(&quot;name&quot;) & &quot;& address&quot;  & counter &  &quot;=&quot; & rs(&quot;address&quot;) & &quot;& phone&quot;  & counter &  &quot;=&quot; & rs (&quot;phone&quot;) & &quot;& cusine&quot;  & counter &  &quot;=&quot; & rs (&quot;cusine&quot;) & &quot;& eat&quot;  & counter &  &quot;=&quot; & rs (&quot;eat&quot;) & &quot;& menu&quot;  & counter &  &quot;=&quot; & rs (&quot;menu&quot;)
 counter = counter + 1
 rs.movenext
wend
responseVars = responseVars & &quot;total=&quot; & counter
Response.Write(responseVars)
set rs = nothing
....
 
Ill try to explain my problem with more simplified code:

Hello, I have a list box on the main stage with items in it (qwer with data = qwer, asdf w/ data = asdf, zxcv w/ data = zxcv, and qwe w/ data = qwe) there is also a dynamic text box named &quot;display&quot;. I'm trying to select an item in the list box and have the dynamic text box display database values relating to that item. I'm using ASP and have the server side aspect done, no errors. The ASP page writes a variable string to send back to Flash and then the response.write sends the name and value pairs to the page so flash can get them. I think i narrowed the problem down to this part:
myVars.curName = myName.getSelectedIndex()+1;
but am not sure:confused:

The flash movie is just 1 frame and i have these actions on it own layer

Code:
myName.setChangeHandler(&quot;myHandler&quot;);
myHandler = function (component) {
	myVars = new LoadVars();
	myVars.curName = myName.getSelectedIndex()+1;
	myVars.onLoad = displayLogs;
	myVars.sendAndLoad(&quot;logbook.asp&quot;, myVars);
};
//Extracts log info and displays it using HTML
displayLogs = function () {
	display.htmlText = &quot;&quot;;
		for (var i = 0; i<this[&quot;total&quot;]; i++) {
display.htmlText += &quot;<font color=\&quot;#CC6600\&quot; size=\&quot;11\&quot;><b>&quot;+this[&quot;myRnam&quot;+i]+&quot;</b></font><br>&quot;;

display.htmlText += &quot;<font size=\&quot;11\&quot;><b>&quot;+this[&quot;myAddress&quot;+i]+&quot;</b></font><br>&quot;;

display.htmlText += &quot;<font size=\&quot;11\&quot;>&quot;+this[&quot;myCusine&quot;+i]+&quot;</font><br><br>&quot;;

display.htmlText += &quot;<font size=\&quot;11\&quot;>&quot;+this[&quot;myEat&quot;+i]+&quot;</font><br><br>&quot;;

display.htmlText += &quot;<font size=\&quot;11\&quot;>&quot;+this[&quot;myPhone&quot;+i]+&quot;</font><br><br>&quot;;
		}		
};

:confused:Any ideas why when i click on the items in the list box nothing displays in the dynamic text box?

Revelent parts of the asp code i'm using is:
Code:
theSQL = &quot;SELECT * FROM logbook WHERE (rnam = '&curName&')&quot;
'Run the query
set rs = db.Execute(theSQL)

'Write a variable string to send back to Flash
while not rs.eof
	responseVars = responseVars & &quot;myRnam&quot; & counter & &quot;=&quot; & rs(&quot;rnam&quot;) & &quot;&myAddress&quot; & counter & &quot;=&quot; & rs(&quot;address&quot;) & &quot;&myCusine&quot; & counter & &quot;=&quot; & rs (&quot;cusine&quot;) & &quot;&myEat&quot; & counter & &quot;=&quot; & rs (&quot;eat&quot;) & &quot;&myPhone&quot; & counter & &quot;=&quot; & rs (&quot;phone&quot;) & &quot;&&quot;
	counter = counter + 1
 rs.movenext
wend
responseVars = responseVars & &quot;total=&quot; & counter

'Send the name and value pairs back to Flash
Response.Write(responseVars)
'Destroy objects
set rs = nothing
set db = nothing

The database has values for each column of each record. The column values are all set to text (using access 2k db) and the names are as such:
rnam, address, phone, eat, cusine

Any thoughts?
 
well i got it going. I have to say that dynamic data exchange with a database or xml rocks with flash!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top