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!

A question

Status
Not open for further replies.

Adam14

Technical User
Joined
Nov 8, 2003
Messages
193
Location
CA
I used to come year a couple years ago, and I remember oldnewbie and dave(I haven't seen if he's still here or not), but I had a question and thought you guys might be able to answer it. I have someone who wants to have basketball players be able to enter their own points for games. These will go in a database, that's no problem. But is there anything in Flash that can call the database and display the players' top three games and points? I hope this makes sense. I know nothing of database stuff, I'm just helping with the flash content. Thanks, Adam.
 
Anyone? Or does my question not make sense? I could elaborate if you need me to. Thanks.

Adam
 
I would have answered your question, but just like you, I know nothing (and not really interested...) about database stuff. It is surely possible and a search on Google should turn up a lot of stuff, depending on which type of database connectivity you're looking for...

You might want to check this link...


Regards,

cubalibre2.gif
 
Thank you so much oldnewbie. I used to post under the name Anthropos a couple years back, but I forgot my password. You've always been a great help to me. Do you know of anyway of doing this entirely with flash? I mean, like, storing information and then having it accesible in a ranking order - as in "top three games played this season"?
 
Thank you so very much!
 
This will definitely require some kind of server interaction unless all of the players are typing their information into the same computer which would allow you to store the data locally in a cookie or shared local object.

If you're going to go the database route you can use the LoadVars object to send and receive the data but I'd do the calculation of the top scores etc on the server.

PHP/ASP and Perl, some of the most common serverside languages, are all very quick at manipulating this kind of data whereas Flash is relatively slow at the same processes. Plus formatting the data before you send it means you're sending less data which is obviously beneficial speed and bandwidth wise.

 
Thanks, wangbar. Do you know if it's possible to bring in a set of numbers from a database and have flash calculate whic are the highest three numbers? I appreciate your help.
 
Yes, it's possible but it's better done on the server as the scripting languages used to pull information from databases are much faster at that sort of thing than Flash and then can send only the three values you need to your movie cutting down on the transfer time too.

Either way the code is similar:

Code:
//sort function
doSort = function (arr) {
	for (var j = 0; j<arr.length; j++) {
		for (var i = 0; i<arr.length; i++) {
			if (arr[i+1]>arr[i]) {
				var temp = arr[i];
				arr[i] = arr[i+1];
				arr[i+1] = temp;
			}
		}
	}
	return arr;
};
//test values
testArray = [4, 7, 6, 1, 2, 8, 9, 5, 3];
trace(doSort(testArray));
// 
stop();
 
Wow!! I'm just working my way through beginners' actionscripting tutorials. I appreciate your help , but I think it will quite some time before I can use anything like this, let alone understand it. It's good to know that it can be done. My partner, who's quite adept at programming might be able to make something from this, which might allow me to just try to import the data once it's sorted. Thank you so much.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top