• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

Chapter 4. Flash and Generator > Using an External Data Source

Using an External Data Source

Although using a native data source is convenient for testing, being able to tap into an external data source gives you a lot more flexibility. If you have the Generator 2 server extensions installed on your Web server, using an external data source enables you to change the output for your template every time you update your data source, without having to reopen your Flash file. The external data source can be a comma-delimited text file, an ODBC/JDBC-compliant database, or a Java class.

So far, you’ve used only two variables for your ad banner. In the next exercise, you put those name/value pairs in an external text file. You then use that text file as your data source for the next few exercises. Later in this chapter, you draw information from multiple data sources. Start now by creating your first external data source.

Exercise 4.4 Adding an External Data Source

Creating a text file as an external data source is a straightforward process. You just type in your name/value pairs exactly as you did for the internal data source. This time, however, you leave out the leading pound (#) sign.

Open the text editor of your choice. Notepad works well in the PC environment. SimpleText is a good choice for Mac users.

Enter the following (see Figure 4.10):

name, value

companyName, Fig Leaf Software

tagLine, We’ve got you covered!

Figure 4.10. Setting up an external data source using a text editor.

Save your file as data.txt. Make sure you save your text file in the same directory as your Flash file.


You don’t have to save your data source in the same directory as your Generator template. If you do choose to save your data source in a different directory, you need to make sure that you give Generator the proper path to the file when you reference it. If Generator doesn’t understand the path you give it, your file is not processed correctly.

Open banner3.fla if it is not already open. Click the Generator Environment Variable button.

Replace all the information (your old name/value pairs) with data.txt. (See Figure 4.11.)

Figure 4.11. Replace the native data source with the path to the external data source.

Save your file as banner4.fla and test your movie.

You should see exactly the same thing that you saw when using the native data source, but now you are drawing the values from the comma-delimited text file data.txt.

You’ll continue to use your new external data source for the next few exercises, so leave your text editor open.

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint