A Flash Developer Resource Site

Page 1 of 2 12 LastLast
Results 1 to 20 of 21

Thread: SQL DB --> ASP --> MX Component

  1. #1
    Junior Member
    Join Date
    Mar 2001
    Posts
    18
    At present I am populating a list box component from a SQL Server database.

    I do this by using LoadVars to fire up an ASP page that connects to DB and then loops through recordset and creates a comma-deliminated string that is sent back to Flash whereupon it is turned into an array using split method and for each item in array a new item is created in list box using 'listboxname.addItem'.

    This works fine because I am only extracting one field from the DB. What if I wanted to extract 2,3 or 4 fields on for instance 20 records? What is the best way to pass this into Flash? Do you have to use multi-dimension arrays?

    Before you all go suggesting I use XML...STOP...I want to do it using ASP OK!

  2. #2
    Arckid - Curving the Web
    Join Date
    Dec 2000
    Location
    India
    Posts
    1,412
    i made same for php,mysql ... and working fine ...

    try to get component from flashcomponents.net made by ritesh ... my friend ...

    compo. name is php data glue ...

  3. #3
    Kier,
    XML and ASP are not self exclusive. You can very easily have ASP connect to the database and then generate the XML that represents the data. In fact the only way to use XML in such a way is have it being generated by another scripting language because XML by itself is not capable of connecting to a database.

    XML is a markup language (used to represent data) ASP is a scripting language (used to generate and manipulate data) you can use the together very successfully.

  4. #4
    Junior Member
    Join Date
    Mar 2001
    Posts
    18
    I realise that about XML & ASP enamics. What I meant above was that I don't want to go down that route of producing an XML file. I want to feed the data directly into Flash from ASP.

    aashu.com ... just checking out the link at the moment

  5. #5
    There is no way to accomplish this directly all you are going to be doing is instead of havin asp generate an XML content for flash to read in you are going to have it generate plain text (query string) for flash to read. The middle step is unavoidable because there is no way to have flash directly plug into asp (can only do that with generator). And if you are going to pass multidimensional arrays to flash XML is a much better format than plain text.

  6. #6
    Junior Member
    Join Date
    Mar 2001
    Posts
    18
    aashu.com - I checked out that fDataSet component in flashcomponents.net and again it's using two technologies that I'm not familiar with, namely PHP & mySQL.

    I know the same is possible using ASP & SQL Server so I'd rather persist in looking for a solution using them because time does not permit the learning curve necessary with learning new technologies

    Thanks anyway for introducing me to that site it looks pretty good.

  7. #7
    Arckid - Curving the Web
    Join Date
    Dec 2000
    Location
    India
    Posts
    1,412
    happy Flashing ...

  8. #8
    Junior Member
    Join Date
    Mar 2001
    Posts
    18
    enamics - Yeah, Yeah, I know I have to learn XML at some point! I fully intend to but.......just for arguments sake......what would a multi-dimensional array look like as a text string? For example, what would a 3-dimensional array with 10 records look like?

  9. #9
    colum1=value1;value2;value3;value4;value5;&colum2= value1;value2;value3;value4;value5;&colum3=....... ....

    you would have to write a parser in flash that would get vars and breack apart the values using the seporatator string( ';' in the example) and ur array would look something like this:

    $array['colum1'][1]
    $array['colum1'][2]
    $array['colum1'][3]...

    $array['colum2'][1]
    $array['colum2'][2]
    $array['colum2'][3]...

  10. #10
    Junior Member
    Join Date
    Mar 2001
    Posts
    18
    Thanks. I thought that would be the form it would take. It's basically the same as what I am doing at present but with each column seperated by '&'.

    Anyone have a good parsing routine for automating the process of converting the text string back into arrays in Flash?

  11. #11
    Junior Member
    Join Date
    Apr 2002
    Posts
    6
    Originally posted by enamics
    There is no way to accomplish this directly... ...there is no way to have flash directly plug into asp (can only do that with generator).
    Incorrect I'm afraid, I've been building ASP driven Flash sites since Flash 4 without a hint of any other coding including XML.

  12. #12
    Member
    Join Date
    Aug 2001
    Posts
    44
    Originally posted by Subflex
    Originally posted by enamics
    There is no way to accomplish this directly... ...there is no way to have flash directly plug into asp (can only do that with generator).
    Incorrect I'm afraid, I've been building ASP driven Flash sites since Flash 4 without a hint of any other coding including XML.
    |||||||||||||||||||||||||||||||||||||||||||||||||| |||||

    would you care to share how you go about doing this??

    wolf

  13. #13
    Junior Member
    Join Date
    Apr 2002
    Posts
    6
    Sure, when I get home from work (UK time) I'll post something up

  14. #14
    Junior Member
    Join Date
    Mar 2001
    Posts
    18
    Looking forward to seeing it....


  15. #15
    Senior Member
    Join Date
    Apr 2002
    Location
    Raleigh, NC
    Posts
    419
    You know... you could just use two delimiters instead of splitting the columns up into separate vars. Column 1 could be separated by commas and the vars inside it are separated by pipe chars or something. This way you don't necessarily have to know in Flash how many columns you are going to get. Don't know exactly why you wouldn't, but who knows? Anyway, don't sweat the XML thing -- I do the same kind of thing in PHP and never use XML. At this point its just not necessary for my apps.

    Best of luck to you.

  16. #16
    Junior Member
    Join Date
    Mar 2001
    Posts
    18
    So say my database table has 3 columns: imgid, imgname & imgurl. Would an example of the string returned to Flash be (obviously I would encode it to the correct MIME format):

    results=1010,Image One,img01.jpg#1020,Image Two,img02.jpg#1030,Image Three,img03.jpg#1040,Image Four,img04.jpg......

    What's the best way of parsing that once you get it back into Flash?

  17. #17
    Senior Member
    Join Date
    Apr 2002
    Location
    Raleigh, NC
    Posts
    419
    Here is kinda how I would do it:
    Code:
    records = results.split("#");
    for(x=0; x < records.length; x++){
       row=records[x].split(",");
       //Now the keys in row are the columns in your database, one row at a time
       //To recurse the fields, use another for loop like so:
       for(i=0; i < row.length; i++){
          //Place code to do to each field here
       }
       //Or you can just work with the rows however you want
       myListBox.addItemAt(x, row[1], row[2]);
    }
    Work it however you want. Good luck.

  18. #18
    Junior Member
    Join Date
    Mar 2001
    Posts
    18
    Thanks leason, that's a useful bit of code.

  19. #19
    Senior Member
    Join Date
    Apr 2002
    Location
    Raleigh, NC
    Posts
    419
    No problem, I'm glad it helped.

  20. #20
    Leason I don't think you understood my point. There is absolutely no way to have ASP directly integrated into flash. In order to get ASP data into flash ASP must produce some kind of output, weather it be XML or a text based query string (the only 2 ways of input flash can handle). In your case your using the query string method.. ASP outputs formatted text which is in turn read by flash over the web, there absolutely no direct integration there.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center