9 Replies Latest reply on Dec 6, 2006 2:04 PM by Ricky_Bobby

    Unique XML Help

    Ricky_Bobby
      I found a tutorial on XML and flash. However it only deals with dropping a bunch on nodes in a combo box or list. I need help figureing out how to do the following:

      Lets say that I have an XML that looks like this,

      <table>
      <item id="4" email="email@blank.com" />
      <item id="5" email="email2@blank.com" />
      <item id="6" email="email3@blank.com" />
      </table>

      Now, what I want to be able to do is put a dynamic text field on the stage and say, give me the email address for the id=4. Then in a totally different dynamic text box, give me the email for id=5, and so on. These dynamix text fields will all me in the same frame, so I am wantign to use actionscript on the frame, but need the script that can put a certain attribute in an instance of a text box according to an id that I specify in the code. Can anybody help on this?

      -Yours truly Ricky Bobby
        • 1. Re: Unique XML Help
          Flashpuke23423 Level 1
          First off, Flash sucks hot flaming donkey dikk.

          I'm trying to do something similar, and it won't work. The XML support is long overdue to be upgraded. First off, you can't load XML syncrhonously. And, because of such when you try loading an XML file in a class (for a component) you can't reference anythign else in the class.

          THE XML SUPPORT AND FLASH IN GENERAL IS SHIIT!!!!!!!!!!!!
          • 2. Re: Unique XML Help
            Flashpuke23423 Level 1
            First off, Flash sucks hot flaming donkey dikk.

            I'm trying to do something similar, and it won't work. The XML support is long overdue to be upgraded. First off, you can't load XML syncrhonously. And, because of such when you try loading an XML file in a class (for a component) you can't reference anythign else in the class.

            THE XML SUPPORT AND FLASH IN GENERAL IS SHIIT!!!!!!!!!!!!
            • 3. Re: Unique XML Help
              Flashpuke23423 Level 1
              First off, Flash sucks hot flaming donkey dikk.

              I'm trying to do something similar, and it won't work. The XML support is long overdue to be upgraded. First off, you can't load XML syncrhonously. And, because of such when you try loading an XML file in a class (for a component) you can't reference anythign else in the class.

              THE XML SUPPORT AND FLASH IN GENERAL IS SHIIT!!!!!!!!!!!!
              • 4. Re: Unique XML Help
                Mister Peanut Level 1
                Flashpuke, do you live in a trailer park?

                are you KEVIN FEDERLINE!?!?!?!?!
                • 5. Re: Unique XML Help
                  Mister Peanut Level 1
                  Though you lack education, I can see you still have much creativity!

                  Good for you!

                  Keep on truckin'!
                  • 6. Re: Unique XML Help
                    Flashpuke23423 Level 1
                    Sorry, flash is still crap. Clearly all they care about is Flex, and we can see how well that is doing.
                    • 7. Re: Unique XML Help
                      Level 7
                      import mx.xpath.XPathAPI;

                      var itemId:Number = 4;
                      var path = "*/item[@id='" + itemId + "']";
                      var tableNode:XMLNode = myXMLDoc.firstChild;
                      var itemNode:XMLNode = XPathAPI.selectSingleNode(tableNode, path);

                      trace(itemNode)
                      trace(itemNode.attributes["email"]);


                      • 8. Re: Unique XML Help
                        Ricky_Bobby Level 1
                        Wow, thanks raymond. this looks confusting, but thanks for helping me out, I will use this code as a starting point. Any chance you could comment on this line you wrote:

                        var path = "*/item[@id='" + itemId + "']";
                        • 9. Re: Unique XML Help
                          Ricky_Bobby Level 1
                          Can someone tell me if I am on the right track with this. Let's say that my dynamic text field has an instance name of email. and my xml looks like the following:
                          <table>
                          <item id="4" email="email@blank.com" />
                          <item id="5" email="email2@blank.com" />
                          <item id="6" email="email3@blank.com" />
                          </table>

                          how about this for part of the actionacript

                          var my_key = item.attributes.id;
                          for (my_key = 4){
                          email.text = item.attributes.email; // setting the text field to the email for id=4
                          }