Getting Dynamic Data into Macromedia Flash
Introduction
It did not take long for Web designers to realize that content is king on the Internet. Your website may look cool, but if the content isn't there then you are likely not to have too many visitors coming back. In this article, you will learn how Flash MX can receive content from a database and then present that within a Flash Movie. This is the first step needed to create Flash-based applications. You open up a whole new world of possibilities once you know how to get database content into Flash.
Download source files here.
Flash and Databases
Flash has been able to receive data from databases since the release of Flash 3; the connection is made through a technology called Server Scripting. Traditional client server applications have typically gone directly through an ODBC connection or JDBC connection. The most common server scripting languages are Microsoft's Active Server Pages, Java Server Pages, and Macromedia ColdFusion. The server-generated page collects the database content and passes it on to Flash, as shown in Figure 1.
Figure 1 matthewdavid.ws has all of the content for the site dynamically loaded into it from different databases.
The way in which data is passed is something similar to this:
Step 1. A Web page is downloaded with a Flash movie embedded within it.
Step 2. The Flash movie makes a request to a server-generated Web page.
Step 3. The server-generated Web page connects to a database and receives the content made in the request.
Step 4. The database content is used to generate a dynamic Web page, which is sent to the Flash movie.
Step 5. Flash receives the Web page and ActionScript within the movie tells Flash where to place the content so that it can be viewed.