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
Solved

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

Posted on 2010-09-09
4
447 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
CheckListBox usage 3 71
problems with mysql ODBC Connector and vbscript 4 39
sql_mode 1 30
INDEX does not make a difference, why? 10 60
Foreword In the years since this article was written, numerous hacking attacks have targeted password-protected web sites.  The storage of client passwords has become a subject of much discussion, some of it useful and some of it misguided.  Of cou…
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
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): …
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

856 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