brad62 — 2011-03-14T04:57:56-04:00 — #1
My girlfriend is running a café and I'm working on a website in Flash for her.
I'm planning to make a simple, but nice looking website with some of the things she is selling (sandwiches, sallads, soups and so on).
Sometimes she might add or remove something on her list or maybe change a price or whatever. She is also selling a soup of the week.
So, I thought I would make a db in MySQL and setup a simple admin page where she can change fields for soup of the week or the list of what she is offering.
I have never worked with a connection between Flash and MySQL, so I would like a tip on what to think about or what I should do or not do.
I'm not sure at all, but I guess I need to work with an XML file? Never did that either and not sure if I can make php update something like that?
Or is there a better solution for the thing I'm working on?
I really would like it to be simple for her to update without downloading or uploading files. I want it to be simple for her to use, otherwise she would probably not do it.
system — 2011-03-14T05:40:41-04:00 — #2
You'll want to create a RESTful API or XML-RPC or SOAP service in PHP that you can call from Flash. How you implement it in Flash will depend based on whether you're using AS2 or AS3. It can be very simple or very complex, based on how you choose to implement it. Probably the simplest way to do it would be with SOAP - Build a SOAP service in PHP using SoapServer or nusoap, and then build a SOAP Client in Flash to access the service.
brad62 — 2011-03-14T06:47:53-04:00 — #3
Well, I haven't decided whether to use AS2 or AS3. What would be the easiest?
Would be great if I could make this with only PHP and MySQL. I never used Soap and have no idea of what it is. But not sure if I will be able to learn one more thing here...
Is there an easy way with either AS2 or AS3?
And how do I export a php file to XML? Is that easy?
system — 2011-03-14T07:20:08-04:00 — #4
If you use a SOAP Server in PHP and Client in Flash, you won't have to worry about XML or any of the details of the service. You just plug it in to your library on the server side, connect to a url on the client side, and call your PHP functions directly from Flash.
Go spend a few hours learning and save yourself a few days of programming.
eastcoast — 2011-03-14T21:51:57-04:00 — #5
If you're just loading a few variables from the backend then you don't need the extra layer of complexity that converting to/from xml/soap add.
Just use php to read from the database then output as url encoded name/variable pairs
Then you can easily load these variables in flash without having to parse xml, and assign to a textfield in dozen lines of code. There's no need for anything more complicated than this.
system — 2011-03-15T01:13:01-04:00 — #6
Not sure how that's easier OR better. SOAP libraries exist for both AS and PHP, and it can be rolled out with little effort, has complete error-handling and message reporting capabilities built in, will scale with the application, and completely eliminates the need to build ANY communication infrastructure on EITHER end.... it also allows for multi-dimensional data to be returned without the need for custom architecture of how that data is represented.... it's just easier all-around, more stable, and a standard that any developer can use in the future.
brad62 — 2011-03-15T05:39:02-04:00 — #7
Is it possible to include a box with a php page inside a Flash project? So I can format the output with size and fonts on a php page and then just show the output inside my Flash movie?
Or maybe that was what EastCoast tried to explain here? I just didn't get it how to do it.
system — 2011-03-15T08:38:44-04:00 — #8
It's not what he's saying. You can output HTML from your php page, and display that HTML formatting in a text-box in Flash.
brad62 — 2011-03-15T11:56:15-04:00 — #9
Yes. That would be a simple solution. So I can actually make a textbox in Flash and fill it with the html page that my php code is generating. Then it would be ok. Wouldn't it?
system — 2011-03-15T17:32:33-04:00 — #10
The Flash HTML-formatted textfield only supports HTML text formatting, anchors, and images.