Accessibility

TechNote (Archived)

Overview of Macromedia Flash and database integration

Introduction
A Macromedia Flash movie cannot communicate directly with a database. However, Macromedia Flash movies can "talk" to server-side applications (also referred to as "middleware"). Middleware can query a database and relay data back and forth. There are many server applications available. Some of the most common are CGI, ASP, PHP, ColdFusion and Tango.

Integrating a Flash movie with a database on a server is the key to creating rich, platform-independent web applications. For this process to work, a developer must know many aspects of web application building - including Flash design, ActionScript, writing server scripts, and administering a database. The workload for creating this kind of delivery tends to fall on one person, and requires manual updating when necessary.


Macromedia Flash is a vehicle

For the purpose of this topic, it's best to think of a Macromedia Flash movie as a vehicle for gathering and displaying data. The Flash movie is similar to an HTML-based form in the way that it captures and forwards information. Learning how to use a database with Flash requires a knowledge of how to create a form in Flash. Please follow the links at the end of this TechNote for more information.

Additionally, using a database for the web requires specific knowledge of databases, server applications, server scripting languages and areas that are beyond the scope of this TechNote. Consult your Internet Service Provider (ISP) or server administrator with any questions you may have about your configuration.

Typically, databases that are used for web purposes include Oracle, Microsoft MSSQL and Access, FileMaker, MySQL, FoxPro and Sybase. These databases all use various protocols that work with server middleware. Some are meant for enterprise-level sites, while others are best suited for low-traffic sites.Some common uses for Flash and database interaction include:

Dynamic content

Guestbooks

Password protection
E-commerce
Web application building

Saving the state of a movie

Personalization


Examples of Macromedia Flash and database communicationFlash form data can be inserted into a database:

On the simplest level, a Macromedia Flash form can take in user data via editable text fields. The Load Variables or GetURL actions can send the data (GET or POST) to the middleware, which will compose the data into the correct format that the database requires.
 

Data can be relayed to the Macromedia Flash movie from a database by middleware:
Another popular use is to have a Flash movie's data contents read from a database. This strategy permits the database to be updated continuously. The Flash movie does not have to be manually changed.
 

A URL with query string data can be used to gather unique information from the database:
A Flash movie can also receive database information that is tailored exclusively to the user, based on events that occur while a user navigates through a site. One method is to pass parameters in a URL (known as the "query string") or from form data. The server script can pass those values to the Flash movie. This allows the movie to display contents that are contingent on what the user has done, or depending on where the user came from.

Popular uses for this method include e-greeting cards, shopping carts and personalized pages where it is necessary keep track of a user's activities.
 
Note: This TechNote does not have a live database connection. Data transfer between the Flash movies on this page is done through JavaScript to simulate Flash and database data retrieval.

Additional information
For more instructions on making a form in Flash, see the following Macromedia article and TechNotes:
Deconstructing the Flash 4 Form sample

How to create and submit a form in Flash 4(TechNote 13919)

Using Flash with a CGI form mailer (TechNote 14158)


For further details on Flash and database interaction, see:
Common questions about Flash Remoting
Macromedia Flash Component Kit for ColdFusion
Building a Data-Driven Message Board Using Lasso and Macromedia Flash
Flash and ASP Integration

Building a Form with ASP and Macromedia Flash 4

Flash and ColdFusion Application Development



AlertThis content requires Flash

To view this content, JavaScript must be enabled, and you need the latest version of the Adobe Flash Player.

Download the free Flash Player now!

Get Adobe Flash Player

Creative Commons License

Search Support


Document Details

ID:tn_14482

Products Affected:

flash