14 Replies Latest reply on Nov 15, 2006 1:23 AM by arunbe

    LoadVars object and XML object

    rohai Level 1
      Hi,

      can I use LoadVars for sending variables to asp and then XML for receiving the xml data, created by asp?
        • 1. Re: LoadVars object and XML object
          arunbe Level 1
          sure.
          you can use....
          • 2. Re: LoadVars object and XML object
            rohai Level 1
            THX for your reply. So, I use LaodVars to send variables (sendAndLoad action), define the object, that will receive the requested data (in my case this is a XML object) and the method. Am I right so far? I did all that, but the XML functon does not receive any data. Can you give me an advice or if you have some time to see the code? THX
            • 3. Re: LoadVars object and XML object
              arunbe Level 1
              try this
              • 4. Re: LoadVars object and XML object
                rohai Level 1
                returnXMLVariableName? What is that? Here's my xml script...can you tell me where is a XML VariableName?THX

                var my_xml = new XML();
                my_xml.ignoreWhite = true;
                my_xml.onLoad = function(success){
                if (success){
                var program = my_xml.firstChild;
                program_content.text = program.firstChild.nodeValue;
                } else {
                program_content.text = ("not working.Still.Nothing.HEHE");
                }
                }
                my_xml.load("actions1.asp"+(_url.indexOf("file")==0?"":"?timestamp="+escape(new Date().toString())));
                //my_xml.load("actions1.asp");
                • 5. Re: LoadVars object and XML object
                  arunbe Level 1
                  hi,
                  i cant get your problem exactly..
                  will your asp return a well formed xml ???
                  If so, you can use my code , instead of this one..
                  But, you can also use this one too.....
                  To use this, you jus confirm the path is working or not. (if not try to give the full path) and check the return form of xml.....
                  • 6. Re: LoadVars object and XML object
                    rohai Level 1
                    Hi, THX for your help so far. Here's the whole story. I have a main swf (system.swf) where all the function are and all the swfs are loaded into system.swf. There's a function named program, which sends variables to asp, loads the program.swf, where the xml script is. The probles is:

                    if I don't send the variables to asp and just load the program.swf, it reads the xml, asp created (in asp I didn't use querystring from flash, instead I said which ID must be used in SELECT sentence - .....where programID = 1);
                    if I send the variables to asp and use them in SELECT sentence - ....where programID = " & Request("programID") &", the program.swf does'nt load the XML;

                    First, when I used only send action, the asp page opened in a new window, showing created XML so I think the variables are sent correctly to asp. It's the receiving part that makes the problem.
                    • 7. Re: LoadVars object and XML object
                      arunbe Level 1
                      did you use the code what i sent ????
                      • 8. Re: LoadVars object and XML object
                        rohai Level 1
                        not yet.I'll try that later...can you tell me what the returnXMLVariableName is?
                        • 9. Re: LoadVars object and XML object
                          arunbe Level 1
                          how you are sending the xml from asp ??
                          If suppose, you are using php means, you can send the xml via
                          "echo" command. like that in which way u are sending the xml from asp ???
                          • 10. Re: LoadVars object and XML object
                            rohai Level 1
                            here's my asp code:

                            scene = Request("scene")

                            if scene = "program" then
                            programID = Request("programID")

                            response.ContentType = "text/xml"
                            sqlProgram ="SELECT subid, title, content, category FROM subparty WHERE subid = " & programID & ";"
                            set rsProgram=oConn.Execute(sqlProgram)
                            response.write("<?xml version=""1.0"" encoding=""utf-8""?>")
                            response.write("<content>")
                            response.write("<![CDATA[ """ & rsProgram("content") & """" & " ]]>")
                            response.write("</content>")

                            rsProgram.Close
                            Set rsProgram= Nothing
                            end if
                            • 11. Re: LoadVars object and XML object
                              arunbe Level 1
                              hi,
                              you writing the xml line by line in the response.
                              Instead this, write them in one execution and use my sample code.

                              with the change of this..


                              myVars.onLoad = function(success) {
                              if (success) {
                              trace("Return XML :"+this);
                              }
                              };

                              • 12. Re: LoadVars object and XML object
                                rohai Level 1
                                Hi, just one more think....can you show me an example how to write xml in one execution and why is these way better. AND THX A LOT FOR YOUR HELP
                                • 13. Re: LoadVars object and XML object
                                  rohai Level 1
                                  I did try your code and here's the error I got:

                                  onLoad=%5Btype%20Function%5D&programID=1&scene=program
                                  Error opening URL "file:///C|/Inetpub/wwwroot/actions1.asp?onLoad=%5Btype%20Function%5D&programID=1&scene=p rogram"

                                  Where did this part (%5Btype%20Function%5D&) come from? Any ideas?And why is there a new querystring onLoad?
                                  • 14. Re: LoadVars object and XML object
                                    arunbe Level 1
                                    hi,
                                    do onething, just use a string in asp.
                                    and add all the xml string in that string and then
                                    finaly write the string in the response in a single execution...