Displaying Multiple Access Records with Flash and ASP
Most Flash & ASP tutorials only deal with returning one row of information at a time from the database to the Flash movie. I was interested in displaying multiple records and fields simultaneously. One resource (FlashCFM.com) pointed the way and I used this start to arrive at a nice solution which is explained here.

I wrestled for quite sometime on how to integrate Flash with Active Server Pages and owe a lot to some excellent tutorials available on the web :
www.15seconds.com/issue/010605.htm and www.asp101.com/articles/flash/

However, most of these tutorials only dealt with returning one row of information at a time. I was interested in displaying multiple records and fields simultaneously. One resource pointed the way and I used this start to arrive at the following solution.

Database
Download Access table here

ASP Page
To get this to work, you must format your ASP to output results in a way Flash can interpret them. Flash reads variables in URL encoded format - i.e.:

 &name    = Bob

Flash sees this as the variable "name" having the value of "Bob". Sounds great, but how do I do that? Here is the code:

 

ASP explained
The code is fairly straightforward :

  1. Connect to your Access table and loop through each record
  2. As you loop set up a variable - here I use " collect " - and concatenate each new value to this variable as you loop through the data table. Also, after you add each new value to the value of "collect " add the "&," character. This will tell flash that a new value pair is coming as well as format the results so that Flash can handle them as an array.
  3. Response.write out the contents of the collect variable assigning these values to the variable "output"
  4. The process is the same for each table field you wish to return to Flash as you can see from my example with the variable "eoutput"
  5. Set up a variable named Counter and give it the value of 1. We will use this later to signal Flash that our results are ready to be displayed.

The output from this ASP page looks like this :

&output=Bill Sanders,Mark Winstanley,Betty Boop,Chief Crazy Horse,JoJo Yes,Junior
Whiz,Wild Bill,Calamity Jones,Louie Louie,New Kid,Delia Q. Sanders,Charley Clapp,
George Galore,Harry Potts,Vern Lawrence,Holy Cow,end
&eoutput=bill@sandlight.com,mark@smoggywood.com,poopoopeedo@easy.net,
drums@feather.com,jeepers@castle.gov,buzz@wordnow.org

Now - we are ready to put these variables into Flash!
Next: The Flash side of things

Place your comment about Displaying Multiple Access Records with Flash and ASP




You must me logged in to write a comment
Comments
Good Info, but didn't work for me
December 19, 2003 by Mary MaryMary
I followed the tutorial and I created my connection to SQL rather than Access. When I run the ASP I get the data as it said it would appear in the browser. I downloaded the Flash application and made sure the right ASP page was being called. However, no data ever appeared. It just sat there loading. I don't understand if thre is a problem in the code or if I have done something wrong. I wish it worked fro me ebcause I would really like to see the output.
just a hint
September 8, 2003 by Joaquim Rendeiro

wouldb't it be easyer if you used xml?

i mean, you could return the records like <record name="John" email="j@you.us" />.

i'm saying this only because the performance of splitting strings and using arrays ends up loosing against the performance of the xml object in flash mx. this counts only if you have a lot of records, of course. if you work with a few records only, you can forget all that i said, because time diferences aren't so noticed.

keep up with the good work...

::Well appreciated tutorial::
August 15, 2003 by Doc Navarro

helped me obtain ideas about connecting datagrid Flash UI Component to a database... specially the string splitting... pretty cool, but i need another assistance regarding commanding Flash to display a picture directly out of a database... thanks for the tutorial... g'day...

RE: Tutorial Update
May 14, 2003 by Alessandro Cacciagrano
gdkghkghkghk
See all 8 Comments