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

Loading Data from Mysql upon movie load 1

Status
Not open for further replies.

exit12

Technical User
Aug 19, 2003
44
GB
Hi,

I'm slowly getting my site together and have a button which when pressed displays, messages etc.. from a mysql database. I want to know how to get this info to load automatically when the actual flash movie loads, so I don't have to push my refresh/display. Heres the code I have for my display button.

display.onRelease = function() {
messages.htmltext = "";
myLoader = new LoadVars();
myloader.ran = random(999);
//again change the next line
myLoader.sendAndLoad("loader.php", myLoader, "POST");
myLoader.onLoad = function() {
for (i=0; i<this.n; i++) {
messages.htmltext += "Name: " + "<b>"+this["name"+i]+"</b>"+"<br>"+this["email"+i]+"<br><br>"+this["msg"+i]+"<br>"+" ----------------";
}
};

};

I'm unsure how to get this mysql data to load automatically.
Any help would be much appreciated. Thank You
 
In actions layer of first frame of main timeline.

Code:
function getVars() {
	messages.htmltext = "";
	myLoader = new LoadVars();
	myloader.ran = random(999);
	//again change the next line
	myLoader.onLoad = function() {
		for (i=0; i<this.n; i++) {
			messages.htmltext += "Name: "+"<b>"+this["name"+i]+"</b>"+"<br>"+this["email"+i]+"<br><br>"+this["msg"+i]+"<br>"+" ----------------";
		}
	};
	myLoader.sendAndLoad("loader.php", myLoader, "POST");
}
getVars();
Hope it helps.

Wow JT that almost looked like you knew what you were doing!
 
Hi, Thanks alot. That worked perfectly!

How would I enable it to refresh and reload itself once a user submits there details to the shoutbox? is this possible?

This is the actions I have on the add button so far

addButton.onRelease = function() {
myData = new LoadVars();
myData.name = name.text;
myData.email = email.text;
myData.msg = msg.text;
//you must change the url in the next line to your own
myData.sendAndLoad(" myData, "POST");
name.text = "";
email.text = "";
msg.text = "";
};

Is it easy enough to allow it to automatically refresh itself?

Thanks
 
setInterval() and updateAfterEvent().

Hope it helps.

Wow JT that almost looked like you knew what you were doing!
 
Hey pixl8r

Did a search on those two and seems this is what I need. I've read through few examples but still unsure as where and how I place them in my movie..

any pointers much appreciated, I'd also like to understand how these work if anyone can explain it in a simple easy to understand manner! :)

Thanks all
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top