A Flash Developer Resource Site

Results 1 to 12 of 12

Thread: Still baffled by ASP variables and Flash...

  1. #1
    Junior Member
    Join Date
    Jun 2002
    Posts
    15
    I hate to continue this thread and demonstrate my absolute lack of knowledge on this subject so publicly, but I hope everyone can be patient with me. I've been writing ASP, VB, SQL, etc. for years and years, but I'm new to Flash and a little confused...

    I have followed all the posted suggestions, however, my Flash movie is reading everything EXCEPT the value of the ASP variable. You see, I use a SQL statement to retrieve a recordset and the correlating value for this variable. As long as I don't include the code for the recordset, my hard-coded ASP variable value gets passed into MX just fine.

    However, with the recordset as output from the asp I put:

    Response.write "&Flash_LevelID=" & rs(0)

    My Flash movie is only seeing:

    Flash_LevelID= "

    ---- OR ----

    If I change the ASP code to:

    Response.write "&Flash_LevelID=" & rs(0) & "&"

    then what Flash sees is:

    Flash_LevelID="\"

    ---- OR -----

    I have also tried:

    Response.write "Flash_LevelID=" & rs(0)
    (without the ampersand before the variable name)

    In response, my Flash movie is only seeing:

    Flash_LevelID= undefined

    -----------------------------------------------
    Like I said, if I create ASP code that says:

    "&Flash_LevelID=23&"

    Then Flash reads CORRECTLY:

    Flash_LevelID=23
    ----------------------------------------------

    Apparently I've missed something very important in transferring the values from ASP recordset and I just can't get a handle on what it might be.

    Can someone who knows what they are doing with these crazy ASP recordsets and Flash variables help me?

    Thank you, thank you, thank you!

  2. #2
    Senior Member
    Join Date
    Jul 2000
    Posts
    336
    What is the code in Flash you are using to load the variables?

    I've been doing it like this

    myVar = objRS("Fieldname")
    Response.Write "&myVar=" & myVar

    and that seems to load fine.. it might be in how you are using the flash coding to bring it in..

    .fe.

  3. #3
    Junior Member
    Join Date
    Jun 2002
    Posts
    15
    Thanks final_eternity....

    Here's my Flash MX code...

    externaldata=new LoadVars();
    externaldata.load("HeirarchyXMLFlash.asp");


    The Flash_LevelID variable exists in both ASP and in my Flash movie. The Flash movie sees the correct value if I hard-code something in the ASP for Flash_LevelID, but not if I try to pass a recordset value.

    Thank you very much for helping me! I'm just about to pull my hair out after chasing this one for over a week!

    Amy

  4. #4
    Senior Member
    Join Date
    Jul 2000
    Posts
    336
    That is interesting.. looks like it should work.

    I am actually having a problem right now loading ASP data with LoadVars() ...

    seems if I do
    LoadVarsObject.load("whatever.asp")
    it wont load correctly

    if I do
    LoadVarsObject.load("http://localhost/folder/whatever.asp"
    everything loads perfect..

    Might be same problem for you..

    Try setting a variable to your recordset value then doing
    Response.Write "&myVar=" & whatever you set it to

    ..?


  5. #5
    Junior Member
    Join Date
    Jun 2002
    Posts
    15
    Well, I tried your suggestion and that, too, didn't work. In fact, it got the same results. I'm just stumped....

    On the other hand (and this is probably a really dumb question since you obviously know what you are doing) --

    You said:
    ------------------
    seems if I do
    LoadVarsObject.load("whatever.asp")
    it wont load correctly

    if I do
    LoadVarsObject.load("http://localhost/folder/whatever.asp"
    everything loads perfect..
    ---------------------------

    Is "Whatever.asp" stored on an IIS server in the same location as your "*.fla" file? If not, that could be the problem with your pathing. I'm sure you've thought of this, but every suggestion we have from our own experience might help another newbie!

    If you come up with any other suggestions, please let me know!

  6. #6
    Senior Member
    Join Date
    Jul 2000
    Posts
    336
    Yeah, the asp file is in the same directory. That is why I am baffled as to why it wont work unless I put a full path in. It finds the file, it just jumbles all the information up.

    If you are on IIS or something similar, try changing your file to the full path, like

    LoadVar.load("http:/localhost/NewSGCS/GetHours.asp");

    see if it works that way..

    here I am trying to help you out and I am just a nearly baffled..

  7. #7
    Junior Member
    Join Date
    Jun 2002
    Posts
    15
    Way too weird. Can you use virtual pathing at all? (i.e., "//ServerName/Directory/File.asp") That's worked for me....


  8. #8
    Senior Member
    Join Date
    Jul 2000
    Posts
    336
    Doesnt seem to work for me..

    I was under the assumption that if my asp was in the same directory as my swf, that all I had to do was put "whatever.asp" and it would work.

    Up to this point, it hasn't. This is the first time i've been stumped on something in Flash for a couple months.

    And no one seems to be answering any of my other pleas, so maybe nobody knows what is going on.

    If you figure your problem out, let me know, cause it might lead to me figuring mine out.

    From the way i've been doing things, your way should be working.

  9. #9
    Junior Member
    Join Date
    Jun 2002
    Posts
    15
    It may have something to do with using "LoadVars()". I know that when I've used:

    "loadVariables("//ServerName/Directory/filename.asp", 0, "GET")"

    I've encountered no problems. However, after my last post to you, I went back and tried loading with "LoadVars()" and cannot load from a virtual directory like that. It has to be only the file name and the file has to be located in the same location as the "*.fla" file.

  10. #10
    Member
    Join Date
    Nov 2001
    Posts
    55
    Well, I cannot help you with your problem, because I do not know anything about. So - what I am doing here, huh? I want to suggest completely different attitude. When I am loading something into flash from database, I always use XML. It is simple and much more flexible. You can do virtualy miracles with XML. And if you combine XML with XSLT, then it is even more powerfull. So think about it.

  11. #11
    Junior Member
    Join Date
    Jun 2002
    Posts
    15
    Thanks, Borut. I am using XML for part of this development, but in this particular instance I need to pass an ASP variable into the Flash from a recordset queried on a login page.

    If you come up with any other suggestions, please let me know!


  12. #12
    Senior Member
    Join Date
    Jul 2000
    Posts
    419
    this is not a problem, it's because you are testing locally, when you test your movie trace out your movie path it probably says something like "C://inetpub/wwwroot/website/movie.swf" or something simular, this does NOT kick in the iis. you for anything to work you will need to specify "http://localhost/website/flashvars.asp"

    this executes the asp correctly, eighter way when your ready to upload to the server (which doesn't care how you do it) then

    loadVarsObject.load("flashvars.asp"); // will work correctly on the production server


    what I do is set a var to my path like
    myPath = "http://flashvars.asp";

    then when I'm ready to sent to production server I change that code to
    myPath = "flashvars.asp";



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