views:

18

answers:

3

Hi All, I have a website in which the content on the index page is controlled by a PHPMyAdmin database. I want a a flash "movie" at the top, that can take the data from the site, and slide-show it until a user clicks on a specific link, in which the movie will direct itself to the clicked event.

The page is for a booking/promotion concert company. They want a "Featured Shows", "Calendar", and flash file that all are interconnected. One page. Does anyone know how to do this, where to find tutorials, or so on? Note, i'm not wanting to WRITE data to the database, I just want to GET data to post on the flash file.

Any help would be greatly appreciated!

A: 

You could read the content of php file, which would return database content in XML format.

You can view a tutorial here : http://www.flepstudio.org/forum/tutorials/2914-retrieve-data-mysql-flash-cs3.html

Dominique
A: 

Flash can do Remoting, which is basically Adobe's version of AJAX-type behavior in Flash. It has its own data format, AMF (action message format). I've used AMFPHP as an open source alternative to having to use Adobe's own servers. With this you can (relatively) easily send data to/from the server and have it automatically turned into the appropriate ActionScript and PHP data constructs on either end.

Marc B
A: 

There are two steps with your question, the first one is to retrieve the data from your database, the second is how to format this data and use it in Flash.

As far as retrieving the data is concerned, a common solution is to use PHP. You will need a PHP script that will query your database, return the content and format it. You should find plenty of tutorials on the net for getting the content from the database. Once you have this content , you will need to give it some form of structure. Personally, since the objective is to use this data in Flash , I tend to create "objects" in PHP which I encode with the JSON format. This is a personal preference, a lot of people use XML. Once the objects are created and encoded , I can then pass the data to Flash. Then again, you should find a lot of tutorials on how to structure the response from the database ,either as XML or JSON.

If you plan to use JSON in Flash, you will need to download this library.

http://github.com/mikechambers/as3corelib

JSON is very easy to use, your objects are formatted as a String and in Flash you simply need to take this String and do

 var obj:Object = JSON.decode( jsonString );

This will return an object with all the properties that you've set in PHP. I find that more straightforward than having to go thru all the nodes of an XML.

It's very likely that this object , will be an Array of objects , each object could be a "Show" for instance , with properties such as "date" , "location" , "venue_name" etc... all these would have had to be set in PHP.

Practically, in Flash these objects can be turned into classes ( for instance a Show class and a Calendar class ) which you can then use to display your information an link with one another depending on user interaction.

Check tutorials on - PHP/Mysql - PHP objects & json_encode() or PHP XML output - Basic Object Oriented Programming and classes in Actionscript3 - Flash / PHP communication

There are loads of tutorials on the net covering these subjects.

PatrickS