I am certainly new to this area of the forum and I’ve recently stumbled across an issue which I thought might be common knowledge here.
Basically I require a flash application to read from a MYSQL database. The goal is not to have the Flash application input to the database because I can probably be safe to assume this as impossible. I want the Flash application to read from the database the following fields:
Name
Location (x,y)
URL
Picture
The content will be uploaded using a standard website, alongside with any purchases. The purpose of the flash application is just to show the information.
Yeah, I usually use an approach similar to the “sendAndLoad”.
Basically what I do is create some PHP pages (though you could use ASP[.NET] if you wanted) to get or send the data I want and then generate an XML response. I then read that XML response and do whatever I need to do. It’s essentially a RestFUL Web Service (albeit, usually small).
There are a number of options open to you to do this.
You can use FlashVars to load the data into Flash at run time - your webpage will get the db data you want, then pass it into the SWF when you embed it.
Or, you can use sendAndLoad to call in data from a webpage ‘behind the scenes’. This method allows you to also send data to the page, and so insert it into the db. sendAndLoad is called from the ActionScript, once the SWF is loaded.
Thirdly, you could get all your data from an XML file generated on the server from data in the db.
All of these methods aren’t overly complex, and will help you solve the problem you have.
Thanks for the information, a friend informed me that I might be able to create the application in AJAX, which might be another possible solution to this. I am not particular on what is used. I have previously worked with Flash and I know the concepts are good with Flash but AJAX might pose it’s own problems.
I think maybe the third possible solution might be best for a Flash application, it sounds like it would run faster, particularly as your dealing with a single XML file.
Well, it depends what you’re doing. I use both on a regular basis for all sorts of different applications.
However, the funny thing is: communicating with your database requires server-side scripting (PHP or ASP.NET), so whether you use Flash or AJAX for the front-end, the back-end will essentially be the same.