6 Replies Latest reply on Nov 13, 2006 5:12 AM by rohai

    please, take a minut

    rohai
      Hi,

      I'm sending vars as querystring to asp, which then with SELECT sentence grabs the right data from DB and creates xml. This XML is then loaded into new swf, which is loaded into MC from the first swf. The problem is that it's working if I don't send vars to asp, but only tell the new loaded swf to load data from asp file (in that case I don't use QS in Select sentence). As soon as I change it and send the vars as QS to asp, the new loaded swf doesn't receives any data. I did try with trace to find if and in what form is send from flash and it gave me this result: programID=1&scene=program so I assume this part is working. It looks to me as the swf is loaded to soon. I don't know. Does anyone know a good tutorial on flash sending vars (not XML) to asp, which creates XML and the flash reads the xml? THX for any help
        • 1. please, take a minut
          rohai Level 1
          Now I'm getting the else part of the script:

          my_xml.onLoad = function(success){
          if (success){
          var program = my_xml.firstChild;
          program_content.text = program.firstChild.nodeValue;
          trace(this);
          } else {
          program_content.text = ("not working");
          }
          }

          So it means the onLoad function doesn't perform. Well, it's not a success.How come it's a success if asp creates a xml with fixed QS in a select sentence? What am I doing wrong?
          • 2. please, take a minut
            rohai Level 1
            is there any difference for flash if i use in asp:

            response.ContentType = "text/xml"
            sqlProgram ="SELECT subid, title, content, category FROM subparty WHERE subid = 1;"
            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

            or if I use

            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

            If I use the first script, the xml in flash is working. If I use the second one, I get the unseccess result.
            • 3. Re: please, take a minut
              Level 7

              "rohai" <webforumsuser@macromedia.com> wrote in message
              news:eivhmp$17u$1@forums.macromedia.com...
              > is there any difference for flash if i use in asp:
              >
              > response.ContentType = "text/xml"
              > sqlProgram ="SELECT subid, naslov, vsebina, kategorija FROM subparty
              > WHERE
              > subid = 1;"
              > set rsProgram=oConn.Execute(sqlProgram)
              > response.write("<?xml version=""1.0"" encoding=""utf-8""?>")
              > response.write("<content>")
              > response.write("<![CDATA[ """ & rsProgram("vsebina") & """" & " ]]>")
              > response.write("</content>")
              >
              > rsProgram.Close
              > Set rsProgram= Nothing
              >
              > or if I use
              >
              > 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
              >
              > If I use the first script, the xml in flash is working. If I use the
              > second
              > one, I get the unseccess result.
              >

              Did you copy/paste the ASP above? I don't program in ASP but I assume that
              it too has an assignment operator = and a equality comparison operator ==.
              In your code you have
              if scene = "program" then

              What does you load line look like?


              • 4. Re: please, take a minut
                rohai Level 1
                THX for your reply. I think the asp is not causing any problem. I've tested the code with QS in URL (localhost/actions1.asp?programID=1&scene=program) and if I use in Flash AS send instead of sendAndLoad, the asp receives the QS, but the problem is that it opens in a new window, creating a xml.

                Here's my AS code:

                this is from system.swf, where the functions are:

                home_mc._visible = false;
                main_mc._visible = false;

                var mcl:MovieClipLoader = new MovieClipLoader();
                var mclL:Object = new Object();
                mclL.onLoadProgress = function(target,loaded,total){
                loaderA.percent.text = Math.round((loaded/total) * 100) + "%";
                }

                mclL.onLoadInit = function(){
                loaderA._visible = false;
                loaderA.percent.text = "";
                }

                mcl.addListener(mclL);
                mcl.loadClip("home.swf", home_mc);

                var mcLoader:MovieClipLoader = new MovieClipLoader();
                mcLoader.addListener(this);

                program = function(){
                movie = this.swf;
                id = this.query;
                var sendProgram = new LoadVars();
                sendProgram.scene = movie;
                sendProgram.programID = id;
                sendProgram.sendAndLoad("actions1.asp","POST");
                home_mc._visible = false;
                main_mc._visible = true;
                mcLoader.loadClip("program.swf", main_mc);
                trace(id);
                trace(movie);
                trace(sendProgram);
                };

                onEnterFrame = function(){
                _root.loaderA.spin_mc._rotation+=10;
                };

                This is the code from scene.swf, which is loaded into system.swf and where the button, that calls the program function is:

                program_btn.swf = "program";
                program_btn.query = "1";
                program_btn.onRelease = this._parent._parent._parent.program;

                And this is the code from program.swf, where the textbox into which the xml is/should be loaded:

                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: please, take a minut
                  Level 7

                  > sendProgram.sendAndLoad("actions1.asp","POST");

                  This is not correct.

                  Usage:
                  sendProgram.sendAndLoad(url:String, targetObject[, method:String]) : Boolean

                  The targetObject is the Object that will be receiving the loaded variables
                  back from actions1.asp.

                  You can use the same "sendProgram" object...

                  HTH


                  • 6. Re: please, take a minut
                    rohai Level 1
                    In Flash help is said you can use an xml object. So I used as object, that receives the XML from asp, my_xml. Still not working. Here's the code in a system.swf

                    program = function(){
                    movie = this.swf;
                    id = this.query;
                    var sendProgram = new LoadVars();
                    var my_xml = new XML();
                    sendProgram.scene = movie;
                    sendProgram.programID = id;
                    sendProgram.sendAndLoad("actions1.asp",my_xml,"POST");
                    home_mc._visible = false;
                    main_mc._visible = true;
                    mcLoader.loadClip("program.swf", main_mc);
                    my_xml.ignoreWhite = true;
                    my_xml.onLoad = function(success){
                    if (success){
                    var program = my_xml.firstChild;
                    main_mc.program_content.text = program.firstChild.nodeValue;
                    } else {
                    main_mc.program_content.text = ("not working.Still.Nothing.HEHE");
                    }
                    }

                    trace(id);
                    trace(movie);
                    trace(sendProgram);
                    };


                    Do I still need a seperate line my_xml.load(actions1.asp) or I don't need that line?THX for your help so far