Hello .. I'm trying to develop an online trivia game using Flash. Everything is going fine. I have used a tutorial & added some new features but currently I'm having a problem which is the trivia questions & answers are loaded from ASP.NET databases. Actually, I know nothing about ASP.NET. I don't know how to use it to make databases & to load data from them. I use PHP & MySQL. My question is how can I use MySQL instead of ASP.NET to load the data (if possible). If not .. then can you provide me with some tutorials on how to make it in ASP.NET & the server requirements. The data is loaded like the examples below: varSomeVariable.load("http://www.yourdomain.com/somedirectory/getthedata.aspx"); varTriviaSend.sendAndLoad("http://www.yourdomain.com/somedirectory/getthedata.aspx",varReceivetheData,"GET"); http://www.yourdomain.com/somedirectory/getthedata.aspx?SomeNum=5 Code (markup): As you may notice, the data is loaded through a url which is not the case when you use MySQL. I'm somehow confused. What do you think ?
the data will come from a database, not a page. check in web.config for connection strings or the code-behind page for getthedata.aspx
Thank you for your reply. Actually there's no web.config & I don't understand what do you mean by "code-behind page for getthedata.aspx" I will type below what does the tutorial say about the database thing & the important part of the actionscript that contains the links. Database tutorial description: All of the questions are pulled into the application from a web application driven by a database backend. The questions are randomly selected by the application. An array is used to keep track of the user’s answered questions to be sure they don’t get the same question twice. You can set your application up to pull data from the application provided on the tutorial web site by using the address shown in the code below. This application interacts with the external data application by loading the questions as needed. This keeps the amount of data loaded to a minimum which helps boost the speed of the application. You can view the FlashDBTrivia.txt file to see the initial data loaded, which is just a count of the number of questions in the database. Then if you open the FlashDBTrivia2.txt file, you’ll see what happens when a question is requested from the data application. Both of those files are included in the ZIP package created for this tutorial. These files are formatted properly for use in Flash files as the data has been URL encoded by the application. As noted above, the application loads data from a web application. You can see the data returned at the following address: http://www.yourdomain.com/somedirectory/gettriviaquestioncount.aspx http://www.yourdomain.com/somedirectory/getthedata.aspx?SomeNum=5 As you can see, the data is URL encoded so that it can be properly imported into Flash. The first link will pull the number of questions found in the database, held in the qCount variable. The second link is called when the application randomly chooses the next question to retrieve. The data includes currentQ, answerList, and correctList. An errorMsg element is included on each page as well. If an error occurs loading the data, the errorMsg variable will be populated. Otherwise, just the items listed above will be displayed on the respective pages. The answerList and correctList data lists are actually pipe-delimited (‘|’) lists that allow the application to quickly split the list of items into an array, using the split method of the array object in Flash. Again, since the application will continue to make calls to the database application, it needs to use the remote server demonstrated in the code below unless you develop and host your own application to retrieve the data. If you wish to develop your own script, be sure that your application formats the data properly. For this application, I use ASP.NET to retrieve data from a multiple data tables. The database diagram for these tables is shown in Figure 1 below: ActionScript: The next block of code declares a variable to hold the number of questions in the application. We’ll also create a LoadVars object that will be used to get the number of questions found in the database: //Determine the number of questions in the database var numQCount:Number; //Create trivia data receiver objects var varTriviaCount:LoadVars = new LoadVars(); //Load the data from the external web application varTriviaCount.load("http://www.flashydata.com/flashydata/gettriviaquestioncount.aspx"); Code (markup): //Load the data from the external web application varTriviaSend.questionNum = numRandomQ; //varTriviaSend.send("http://www.yourdomain.com/somedirectory/getthedata.aspx","_blank","GET"); varTriviaSend.sendAndLoad("http://www.yourdomain.com/somedirectory/getthedata.aspx",varTriviaReceive,"GET"); Code (markup): FlashDBTrivia.txt qCount=30&errorMsg= Code (markup): FlashDBTrivia2.txt currentQ=What+is+the+name+of+your+team+that+plays+in+the%2c+arena%3f&answerList=white+wings%7cFridays%7cLions%7cLizards&correctList=1%7c0%7c0%7c0&errorMsg= Code (markup): I think that's everything. Can you explain how can I make it work with my own DB ? Thank you for your time.
Here is the sample code for retriving data tables and executing SQLs to MYSQL server. http://ask4asp.net/post/using-mysql...anding-database-operations-mysql-asp_net.aspx