A Flash Developer Resource Site














Internet Commerce

Partners & Affiliates














Developer Channel

internet.com


Featured Flash FLA
Gallery Downloads 11303 Flash Movies | 7 New Flash Movies Added
What's New | Top 100

Featured FLA

» Author: Nitin Tikhe
» Title: Cart
» Description: This Animation Tut is a fun and useful for kids below 15 years. Watch the Flag, Doors, Stick and Horse movements.
» More by Nitin Tikhe


Random FLAs | Add Flash Movie
Featured Flash Site
Gallery Downloads 6008 Flash Sites | 0 New Flash Links
What's New | Top 100 Flash Site

Featured Site

» Posted in the Flash Kit Links section
» Title: Banana Swimwear
» Description: This is a banana swim wear interactive catalog we designed and animated in Flash


Random Links | Add your own Flash Related Links
Flash Tutorials 1255 Tutorials 7 New Tutorials Added!
What's New | Top100

» Make flash video player for broadcasting live streaming video / TV on website
» How to convert the project file of Flash Demo Builder 2.0 into FLV file
» FLV to PSP for Mac - How to convert YouTube video to PSP on mac
» How to Convert FLV to MP4 for Playback on iPod
» how to download and convert youtube video to AVI with Leawo Free FLV converter
» Flash Multi-player Game Tutorial - TicTacToe
» How to make Flash elearning tutorials with screen recorder?
» Fader API:Slideshow with MovieClips on stage
» How to convert MS PPT file into an FLV File
» Unknown Tag: Title10
Random Tutorial | Add Site

Network Design Manager
The Computer Merchant, Ltd
US-VA-Hampton

Justtechjobs.com Post A Job | Post A Resume


Tutorials Home What's New Top Rated Submit myTutes Random!

Search Tutorials


Tutorials Tutorials » Dynamic_Content

Categories Proxy Scripting in Flash - Loading External Data
Author: Jeffrey F. Hill | Website: http://www.flash-db.com |

 
Page 1
1 2 3 4 next»


Introduction

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.

Overview

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).

1 2 3 4 next»

» Level Advanced

Added: : 2002-04-05
Rating: 7.08 Votes: 27
Hits: 1736
» 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.
Download (18 kb)
Get conversion and unzipping tools for PC and Mac here!

» Forums
More help? Search our boards for quick answers!

Please rate this tutorial, 10 is the top rating, you can also click the comments link to read/write a review.
10 9 8 7 6 5 4 3 2 1
Read or Post Comments