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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Flash and ASP not working

Status
Not open for further replies.

idratherbearobot

Programmer
Aug 24, 2004
2
US
I am writing a flash movie that will read a dynamicaly generated list of file names from an ASP script.

The issue I am having is that when Flsh accesses the ASP via loadVariablesNum, it is reading it as a tesxt file, not an ASP.

I have included sample code below to illustrate what I mean.

Sample ASP:
<%
dim xvar
For index = 1 to 5
xvar = xvar & "x,"
Next
Response.Write "&testVar=2"
Response.write xvar
Response.write "&"
%>

Sample ActionScript
loadVariablesNum("testASP.asp", 0, "GET");

I then have a dynamic text field with a variable set to testVar.

After accessing the ASP, the text field reads:
2"
Response.write xvar
Response.write "

It should read:
2x,x,x,x,x,

Can anyone help me out? Tell me what I'm doing wrong?



 
Use LoadVars.

Create a movie with just the dynamic text box with the instance name testVar.

My sample has the asp file (exactly as you posted it above) located in a local directory. On the first frame of the main timeline (actions layer) insert the following:

Code:
myVars = new LoadVars();
myVars.onLoad = function(success){
	if(success){
		_root.testVar.text = myVars.testVar;
	}else{
		_root.testVar.text = "Error";
	}
}
myVars.load("[URL unfurl="true"]http://localhost/test.asp");[/URL]

The result in the text box is "2x,x,x,x,x,".

Hope it helps.

Wow JT that almost looked like you knew what you were doing!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top