First time here? First time here? Newsletter Signup Newsletter
Search tutorials
Author: Jeffrey F. Hill | Website: http://www.flash-db.com


One of the greatest things about the internet is the wealth of free information and content available. Their are thousands of websites that allow you to use content from their websites and databases - and display it on yours. Some examples of this are stock quotes, Weather data, News stories, Search engine results, Auction listings, etc - the list goes on and on. Another important aspect of the internet are application service providers, some examples of these services could include CRM's (customer relationship management), Info sharing, sales tracking, e-business, Human resource's, desktop applications, etc - the list again goes on and on.

What do all of these have in Common? - All this data and all these services are not accessible directly by your Flash Movie. What if you wanted to include constantly changing and updated weather reports from noaa - or stock quotes from Yahoo financial - or News feeds from Moreover - or send a new Lead to a CRM service - or send payment information to Authorize.net for processing - or send and retrieve data from a database not located on your server. Well this tutorial goes into one method which allows you to do all of this in Flash - with the User Never leaving your Site!

Recommended reading: "For security reasons, a Flash movie playing in a Web browser is not allowed to access data that resides outside the Web domain from which the SWF originated." - http://www.macromedia.com/support/flash/ts/documents/loadvars_security.htm

Macromedia suggests two solutions or work arounds to this security feature, the first one is Proxy scripting the second involves DNS aliasing. This article/tutorial will go over two examples of Proxy Scripting and how it can be used to create a more diverse and changing Flash movie/experience. I also put together an example of a search engine for a visual example of what this is all about. The search engine is based on Yahoo, but with the results of the search query sent from and displayed in Flash (included in the download) - For a working version/example of the search engine visit - http://www.flash-db.com/Search/. This is just one of many useful applications of this article. Their is also an example of using this method with moreover news at www.flash-db.com/News/.

This tutorial is not for everyone and it will not be possible for everyone to use this. 1) Since a server side script is needed, this script must be run on a server. 2) Some servers do not allow outgoing connections, if your server has this restriction then it will not be possible to run this script. (Some free and really large inexpensive commercial hosting companies will have this restriction due to their firewall settings). 3) These scripts are not needed with Stand-Alone (exe) flash presentations - this is only needed for SWF files embedded in a Browser on the internet.


First it's necessary to define two types of Data/Content that we will be accessing. 1) Static - this involves web pages that are not changing and are not based on information (query terms) that are passed to them. Examples of this would be Text files, HTML pages, and XML content - that reside on a server/domain outside of your own. 2) Dynamic - this involves web pages, database's, and other scripts that look up or perform queries based on the information you send to them.

Static: Loading static content/data from other servers is easier then loading dynamic content. This is because you will not have to build a request method such as "GET" or "POST". This is just fetching or grabbing static content from else where on the web and bringing it back to your flash movie. An example. If you wanted to you could also return Images, SWF's, mp3's, movies etc with this method - although since LoadMovie does not have this restriction their would be no sense in doing this with these types of files.

Dynamic: Dynamic content/data requires that a request be sent via "GET" or "POST". Then depending on the Data you send the page - it reacts and produces results based on your request Data. A good example of this is sending a Search engine a Search Term. If you wanted to search Google for "Flash" you would have to tell it to search for "Flash". Another example would be if you wanted to add a Sales Lead to a service that tracks this information for you. Or if you wanted to send Credit card info to a credit card transaction processor. Or maybe add information to a database on a different server. Basically any time you have to send information to get information in return.

Tying it together: Basic Flow of data: From Flash -> to the Script -> To the external source -> Back to the script -> Back to Flash. The hardest part of all of this (because most data is not returned in nicely formatted XML) is parsing and formatting the data that is returned from the external source to a format Flash can easily display. Easy returned formats to work with include CSV (comma seperated values) TSV (Tab seperated values) - and of course XML (which does not require any parsing since Flash can already read XML). A lot of times you'll have to work with complex HTML stuff coming back which is the hardest to format and parse for use in Flash. This is the real art behind all of this.

Thoughts: Macromedia added this security restriction (external data is not accessible) because Flash can Loop and no user action is needed to send out a request via "GET" or "POST". So at first you might think "Big deal" - but if you look at this further and keep in mind past DOS (denial of service) attacks, you'll see that Macromedia was right by adding this security feature and did so with good reason. What if someone put up hundreds/thousands of really simple Flash movies all over on free web servers that sent out hundreds/thousands/millions of requests to someone's database or site every second. This could become a problem and reduce the performance (or crash) the website that was being targeted. (This last paragraph is just an thought - and may or may not be plausible).

» Level Advanced

Added: 2002-04-05
Rating: 7 Votes: 27
(10 being the highest)
» Author
Jeffrey Hill is a freelance web developer from Boulder, Colorado. He specializes in creating and developing dynamic database driven Flash content, applications, and content management systems. Specialty's include SQL, PHP, Perl, and XML.
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!


  • There are no comments yet. Be the first to comment!

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.
Featured Flash FLA
» Author: Inocreato
» Title: RaiseTheBlocks
» Description: Raise all the blocks to win the game
Featured Sound Loops
Image for equalize

Audio Player

» Author: TomCat Carty
» Title: The Wood
» Description: Just a little game ending or it can maybe be looped. Recorders with music box and percussion to give the feel of well, I don't know, the woods? Free to use, just credit me. thank you
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx
Image for equalize

Audio Player

» Author: Davisigner
» Description: Hmm... what to say about this one? It's reminiscent of the closing notes of the opening music from the Three Stooges done in a church organ style with a closing cymbal crash. I'll give this one away gratis, but feel free to check out my free loops and potential upcoming license-mandated ones over in the respective part of Flashkit.