SitePoint Sponsor

User Tag List

Results 1 to 16 of 16
  1. #1
    SitePoint Addict
    Join Date
    Sep 2000
    Posts
    230
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    ASP/Flash/Access

    Flash/ASP/Access
    I've scoured the archives and have read the older forums, but I still need some help here....

    I have an Access DB, a SWF File, and an ASP page..Im trying to retrieve the data from the db and insert into the swf file...

    All right...I've changed things around a bit and I have this partially working>

    Here's what im trying to do:
    1. Insert values from an HTML form.
    2. Insert values into an Access DB.
    3. Output a page that says that preview.
    4. When the user clicks preview there sent to a page with a SWF that loads the variables from the DB.

    I have the first 3 .. but not the last one.

    So my challenge is taking files from a db and inputting them into a swf file.

    any assitance???
    Last edited by meztec; Nov 28, 2001 at 10:35.

  2. #2
    SitePoint Zealot
    Join Date
    Nov 2001
    Location
    RI, USA
    Posts
    140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    asp/flash basics

    You basically have to create an asp page that will select values from your database and then output (in asp that's response.write) the value to your page that flash is calling (Load Variables("myscript.asp", 0))

    so the asp page needs to look something like this...


    <%

    Dim oRS, oConn ' Recordset and connection objects

    Set oConn = Server.CreateObject("ADODB.Connection")
    oConn.ConnectionString = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("employees.mdb")

    oConn.Open

    Set oRS = Server.CreateObject("ADODB.Recordset")
    oRS.Open "SELECT field1,field2 FROM Table", oConn, 2, 3

    if not oRS.EOF then

    Response.Write "field1=" & Server.URLEncode(oRS("field1"))
    Response.Write "field2=" & Server.URLEncode(oRS("field2"))

    end if

    ' Clean up
    oRS.Close
    Set oRS = Nothing
    oConn.Close
    Set oConn = Nothing

    %>


    Nathan
    nathan@aspapp.com
    in1.com | Bootply - Bootstrap playground

  3. #3
    SitePoint Addict
    Join Date
    Sep 2000
    Posts
    230
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the reply...That's the path i've been going down...no luck yet.

    One of my problems is in the Flash Fla...I want to use loadvariables, but I want to do it when the object loads not (on release or something). How is this achieved? I can't find the actionscript for what I need?

  4. #4
    SitePoint Zealot
    Join Date
    Nov 2001
    Location
    RI, USA
    Posts
    140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    i still have Flash 4

    Which isn't 'actionscript' ready.. but in Flash 4 I would just an a loadvariables action to the frame where I wanted to database value to appear.. make sense?

    nathan
    in1.com | Bootply - Bootstrap playground

  5. #5
    SitePoint Addict
    Join Date
    Sep 2000
    Posts
    230
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks...
    I am getting output now...It is working...But I have a problem.

    I have two dynamic text boxes in my fla:
    client
    charity

    those are my two fields in the asp file too...
    Response.Write "Client=" & Server.URLEncode(oRS("Client"))
    Response.Write "Charity=" & Server.URLEncode(oRS("Charity"))


    However...all the content is being outputted into the client dynamic field in the swf file??

    Any ideas??

  6. #6
    SitePoint Zealot
    Join Date
    Nov 2001
    Location
    RI, USA
    Posts
    140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yup.. I should have put that into my example.. you need the & (ampersand) to separate the name=value pairs..

    so it would be..

    response.Write "Client=" & Server.URLEncode(oRS("Client")) & "&"
    response.Write "Charity=" & Server.URLEncode(oRS("Charity"))

    so it's really outputting

    Client=whatever&Charity=whatever to the HTML that flash is getting


    nathan
    in1.com | Bootply - Bootstrap playground

  7. #7
    SitePoint Addict
    Join Date
    Sep 2000
    Posts
    230
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    cheers..its working!

    Here's another snag i've come up with...

    I have a page where the user inputs:
    client
    charity

    then that prompts a button that says preview
    on preview click the user should see that flash movie with the corresponding client...

    But I cant' seem to get these to relate..

    my code is this:
    Set oRS = Server.CreateObject("ADODB.Recordset")
    oRS.Open "SELECT Client,Charity FROM table1 WHERE Client=" &Request.Form("Client")" ", oConn, 2, 3

  8. #8
    SitePoint Zealot
    Join Date
    Nov 2001
    Location
    RI, USA
    Posts
    140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    concatenation??

    it looks like you just need to change it to this..

    Set oRS = Server.CreateObject("ADODB.Recordset")
    oRS.Open "SELECT Client,Charity FROM table1 WHERE Client='" &Request.Form("Client")& "'", oConn, 2, 3

    that takes client as a string.. and then I added the ampersand to the end to make sure the concatention was in check.
    in1.com | Bootply - Bootstrap playground

  9. #9
    SitePoint Addict
    Join Date
    Sep 2000
    Posts
    230
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks again...still trouble here...some variable passing trouble..

    Reveiw: What I have:
    default.asp
    ---Input data throuh a form...inserts into an access db
    preview.asp
    ---Says thanks for submitting and then has a form button that says preview....Click this will take you here:
    card.asp
    ---This card holds the flash swf file which calls "script.asp"
    script.asp
    ---This file loads the variables from the access db into the flash file..."This Works"


    My Major Problem:
    Is a user submits a client name on default.asp ...
    That name is then sent to preview.asp..Then when preview is clicked that name is referened in the script.asp file so the flash movie outputs that row...

  10. #10
    SitePoint Zealot
    Join Date
    Nov 2001
    Location
    RI, USA
    Posts
    140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    hhmmm

    I guess I don't understand the problem..is the name not getting passed?
    in1.com | Bootply - Bootstrap playground

  11. #11
    SitePoint Addict
    Join Date
    Sep 2000
    Posts
    230
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry .. kind of trailed off there...

    Yes..the name is not being passed...

    It needs to be referenced from script.asp which is in my flash movie such as WHERE Client = x ...
    That's not happening...

  12. #12
    SitePoint Zealot
    Join Date
    Nov 2001
    Location
    RI, USA
    Posts
    140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    so you mean your trying to send the name back from flash so that it can be used to create a query on the .asp page, that will then send the correct record back for display in Flash??
    in1.com | Bootply - Bootstrap playground

  13. #13
    SitePoint Addict
    Join Date
    Sep 2000
    Posts
    230
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've changed things around a bit...

    Here's what im trying to do:

    default.asp
    Has two input fields
    Two Submit boxes
    One to submi info into db
    One to preview the flash...The preview is based on a user submitting a name into the client field then based on that client field it will take that

    e.g
    client=mycompany

    then in the script.asp (which is called from the swf)
    it will say select client, charity where client = mycompany ...

    But i can't seem to pass that client field...

  14. #14
    SitePoint Zealot
    Join Date
    Nov 2001
    Location
    RI, USA
    Posts
    140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What does your loadvariables statement look like?

    did you make sure that the client var in flash has a value when it gets to the loadvariables statement?
    in1.com | Bootply - Bootstrap playground

  15. #15
    SitePoint Addict
    Join Date
    Sep 2000
    Posts
    230
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    my Loadvariables is

    loadvariables("script.asp", "", post)
    (quotes may not be in the right place, i didn't copy/paste)


    Then client text box is declared client in flash

  16. #16
    SitePoint Zealot
    Join Date
    Nov 2001
    Location
    RI, USA
    Posts
    140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok...

    so when you call script.asp, does it do a request("client"), and then assign that value to your SELECT statement ie;

    client = request("client")
    SQL = "SELECT * FROM Table WHERE Client = '" & client & "'"
    in1.com | Bootply - Bootstrap playground


Bookmarks

Posting Permissions

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