Solved

Flash: how to display results of data query - SQL vs. XML (or other)?

Posted on 2010-09-09
4
446 Views
Last Modified: 2013-11-11
I am trying to create a flash Banner Advertisement that will use a database to create a ZIP Code locator. This advertisement will likely get a lot of hits so I need a very efficient solution.

The banner ad will let the user input a ZIP Code into a form field which, when submitted, will query a database to find matching data (i.e. store information) and then display the results in the flash banner file.

I *think* I can do this using an XML file (i.e. instead of querying a database, query the XML file) However, with 20,000+ ZIP Codes and related data nodes, this could be a HUGE XML file - and I'm not 100% positive it is possible.

Is it possible to query a database directly? I suspect so but my concern here is that the banner ad will get tons of hits and strain the database.

Has anybody done something like this before?

What is the best solution?!
0
Comment
Question by:bearclaws75
  • 2
4 Comments
 
LVL 9

Accepted Solution

by:
Jakob_E earned 300 total points
ID: 33643567
Hi,

20,000 nodes of 5-50 characters each will result in a 150-450 KB XML file (you don't want that ;-)

I would do something like this:


// Function that submits the user input to the data base - that
// after processing returns XML containing just enough info
function submitToDB():void{
   
    // Loader and listener
    var loader:URLLoader=new URLLoader()
        loader.addEventListener(Event.COMPLETE,resultFromDBHandler,flase,0,true)
   
    // Request and request method (GET/POST)
    var request:URLRequest=new URLRequest("http://www.domain.com/getZipInfo.php")
        request.method=URLRequestMethod.POST;
   
    // Variables and values
    var vars:URLVariables
        vars.zipCodeInput="10007" // Replace with user input
       
    // Add variables to the request and load
    request.data=vars
    loader.load(request)
}


// Function to handle the XML returned
function resutlFromDBHandler(e:Event):void{
    var xml:XML=new XML(e.data)
    // do other stuff here
}





Best,
Jakob E



0
 
LVL 9

Expert Comment

by:Jakob_E
ID: 33643578
Second function should be resultFromDBHandler not resutl..

 
0
 
LVL 59

Assisted Solution

by:Kevin Cross
Kevin Cross earned 200 total points
ID: 33646660
Agree with above that you can go through PHP.  Here is a reference to support that using Flex.

http://cookbooks.adobe.com/post_Simple_MySQL_to_Flex-5561.html
0
 

Author Closing Comment

by:bearclaws75
ID: 33664713
Thanks. This is exactly what I was looking for.
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikipedia.org/wiki/PHP  Very powerful.  But a…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question