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

problems with LoadVars refresh! 1

Status
Not open for further replies.

MJB3K

Programmer
Joined
Jul 16, 2004
Messages
524
Location
GB
Hi, can someone take a look at this .fla i made. It works perfectly submitting data and retreiving it when first loaded, but my problem is:

How do i make it reload the textbox data when the send button is pressed??

Its a guestbook app!


any ideas??


Regards,

Martin

Gaming Help And Info:
 
You are clearing out the text boxes after you call your send and load.

Code:
addButton.onRelease = function() {
	myData = new LoadVars();
	myData.Name = Name.text;
	myData.Email = Email.text;
	myData.Comments = Comments.text;
	//you must change the url in the next line to your own
	myData.sendAndLoad("[URL unfurl="true"]http://www.webrevolt.biz/fx/php/guestbook2.php",[/URL] myData, "POST");
	[highlight]_root.Name.text = "";
	_root.Email.text = "";
	_root.Comments.text = "";[/highlight]
};
_root.guestbook.htmlText = "";
myLoader = new LoadVars();
myloader.ran = random(999);
//again change the next line
myLoader.sendAndLoad("[URL unfurl="true"]http://www.webrevolt.biz/fx/php/guestbook.php",[/URL] myLoader, "POST");
myLoader.onLoad = function() {
	_root.guestbook.htmlText = myLoader.gb;
};

if you want to use your myData loadVars object to process the incoming data you need to add a myData.onLoad function. I find it easier to create a whole new loadVars object for the incoming data.

This example might help you out.
Code:
function sendInfo(){
	sendVars = new LoadVars();
	sendVars.email = _root.email_txt;

	ASPresponse = new LoadVars();
	ASPresponse.onLoad = receiveReply;
	
	sendVars.sendAndLoad("[URL unfurl="true"]http://localhost/flash/sendandload/processForm.asp",ASPresponse,"POST");[/URL]
}

function receiveReply(result){
	if(result){
		_root.reply = ASPresponse.reply;
	}else{
		_root.reply = "Error";
	}
}

submit.onRelease = function(){
	sendInfo();
}

Hope that 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