13 Replies Latest reply on Oct 27, 2009 2:56 AM by Ron Colmen

    Combine 2 in to one.

    Ron Colmen Level 2

      How combine write a script to pass a valuve from flash to php and load xml results with the onRelease command?

       

      1

      sender.onRelease = function () {
      senderLoad.fin = fin.text;
      senderLoad.sendAndLoad("www.abc.com/myphp.php",receiveLoad);
      }
      receiveLoad.onData = function (src) {
      tf.text=src
      }

       

       

      2

      var fax:Array = new Array();
      var tel:Array = new Array();
      var company:Array = new Array();

       

      x:onLoad (www.abc.vom/myphp.php, onFinish);

      function onFinish($success:Boolean, $results:Object, $xml:XML):Void {

      if ($success) {

        • 1. Re: Combine 2 in to one.
          kglad Adobe Community Professional & MVP

          if xml is being returned from your php script, you only need 1.  just cast that return (src) as xml:

           

           

          RON_ron wrote:

           

          How combine write a script to pass a valuve from flash to php and load xml results with the onRelease command?


          var xml:XML;

          sender.onRelease = function () {
          senderLoad.fin = fin.text;
          senderLoad.sendAndLoad("www.abc.com/myphp.php",receiveLoad);
          }
          receiveLoad.onData = function (src) {

          xml=new XML(src);

          parseXML(xml):

          }

           

          function parseXML(xml:XML){

          // parse your xml here

          }

           


          1 person found this helpful
          • 2. Re: Combine 2 in to one.
            Ron Colmen Level 2

            Thank you sir! That was helpful.

             

            Results displayes as 'undefined' and no image. Attached is just a screenshot of the php output (when run in the browser).

             

            The current  script.

             

            receiveLoad.onData = function (src) {
            xml=new XML(src);
            parseXML(xml);

             

            function parseXML(xml:XML){
            emb.loadMovie(image)= $results.image[0].value;;
            comp.text = $results.company[0].value;
            tf.text = $results.email[0].value;

            }
            {
              gotoAndPlay(10);
              }
            }

            • 3. Re: Combine 2 in to one.
              Ron Colmen Level 2

              I'm getting all text fields 'undefined' and there's no image appearing. My prase seems to be incorrect. I've red many on prasing xml over the net but I don't seem to get how to match them here according to my requirements ($fin).

              • 4. Re: Combine 2 in to one.
                kglad Adobe Community Professional & MVP

                what's the following show:

                 


                 

                receiveLoad.onData = function (src) {
                xml=new XML(src);
                parseXML(xml);
                }

                function parseXML(xml:XML){
                tf.text = xml;

                }

                • 5. Re: Combine 2 in to one.
                  Ron Colmen Level 2

                  it brings up the entire thing.

                   

                  <?xml version="1.0" encoding="utf-8"?><item><email>abc@abc.com</email><image>http://www.abc.com/ruth.jpg</image><datecreated>2009-10-25 05:10:49</datecreated><company>FOR TESTING PURPOSE</company><address>can, roxy, country</address><phone>7-1400-2070</phone><fax>1-2345-6789</fax><genemail>abc-gen@mail.com</genemail></item>

                   

                  I kept on searching simple examples for xml prasing over the net and I can not find any which would help my requiremnt. I'd like to have each item in seperate dynamic text boxes and the image to load in to a movieclip.

                  • 6. Re: Combine 2 in to one.
                    kglad Adobe Community Professional & MVP

                    use:

                     

                    function parseXML(){

                    tf.text=this.firstChild.firstChild.nodeValue;

                    whatever.loadMovie(this.firstChild.firstChild.nextSibling.nodeValue);

                    }

                    • 7. Re: Combine 2 in to one.
                      Ron Colmen Level 2

                      I'm still getting 'undefined' and no image displayed??

                       

                       

                      receiveLoad.onData = function (src) {
                      xml=new XML(src);
                      parseXML(xml);
                      function parseXML(){
                        tf.text=this.firstChild.firstChild.nodeValue;
                        compa.text=this.firstChild.firstChild.nodeValue;
                        addres.text=this.firstChild.firstChild.nodeValue;
                        fasci.text=this.firstChild.firstChild.nodeValue;
                        phone.text=this.firstChild.firstChild.nodeValue;
                        geneml.text=this.firstChild.firstChild.nodeValue;
                        emb.loadMovie(this.firstChild.firstChild.nextSibling.nodeValue);
                        }
                        {
                        gotoAndPlay(10);
                        }
                      }

                      • 8. Re: Combine 2 in to one.
                        kglad Adobe Community Professional & MVP

                        don't nest parseXML().  use the code i gave.

                        • 9. Re: Combine 2 in to one.
                          Ron Colmen Level 2

                          Nothing changed. I'm still getting 'undefined' in all the fields and nothing in the movieclip.

                           

                          PHP alone in browser displays as

                          tf=abc@ghi.comcompa=FOR TESTING-PURPOSEaddres=city,cityfasci=1-2345-6789phone=7-1400-2070geneml=abc@mail.comemb=http://www.bac.com/database/ruth.jpg

                           

                           

                          xml=new XML(src);
                          parseXML(xml);
                          function parseXML(){
                            tf.text=this.firstChild.firstChild.nodeValue;
                            compa.text=this.firstChild.firstChild.nodeValue;
                            addres.text=this.firstChild.firstChild.nodeValue;
                            fasci.text=this.firstChild.firstChild.nodeValue;
                            phone.text=this.firstChild.firstChild.nodeValue;
                            geneml.text=this.firstChild.firstChild.nodeValue;
                            emb.loadMovie(this.firstChild.firstChild.nextSibling.nodeValue);
                            }
                            {
                            gotoAndPlay(10);
                            }

                           

                           

                          PHP

                          if($line = mysql_fetch_assoc($results)){
                          echo "tf=".$line["email"];
                          echo "compa=".$line["company"];
                          echo "addres=".$line["address"];
                          echo "fasci=".$line["fax"];
                          echo "phone=".$line["phone"];
                          echo "geneml=".$line["genemail"];
                          echo "emb=".$line["logo"];
                          }

                          • 10. Re: Combine 2 in to one.
                            kglad Adobe Community Professional & MVP

                            it still looks like you're nesting parseXML()

                            • 11. Re: Combine 2 in to one.
                              Ron Colmen Level 2

                              You mean like this? Still not getting the text & image.

                               

                              xml=new XML(src);
                              parseXML(xml);
                              function parseXML(){
                                tf.text=this.firstChild.firstChild.nodeValue;

                                emb.loadMovie(this.firstChild.firstChild.nextSibling.nodeValue);
                                }
                                {
                                gotoAndPlay(10);
                                }

                              • 12. Re: Combine 2 in to one.
                                kglad Adobe Community Professional & MVP

                                no.

                                 

                                RON_ron wrote:

                                 

                                You mean like this? Still not getting the text & image.

                                 

                                xml=new XML(src);
                                parseXML(xml);
                                function parseXML(){
                                  tf.text=this.firstChild.firstChild.nodeValue;

                                  emb.loadMovie(this.firstChild.firstChild.nextSibling.nodeValue);
                                  }
                                  {  //<--what's this for?
                                  gotoAndPlay(10);
                                  }  // <-- what's this for?

                                • 13. ENDS!
                                  Ron Colmen Level 2

                                  Thanks Sir! I got it working!!