Solved

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

Posted on 2010-09-09
4
449 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 60

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

I have been using r1soft Continuous Data Protection (http://www.r1soft.com/linux-cdp/) for many years now with the mySQL Addon and wanted to share a trick I have used several times. For those of us that don't have the luxury of using all transact…
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

738 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