[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 222
  • Last Modified:

How to read XML file Data from flash

I am trying to read an XML file from Flash with multiple data using a combo box. Once the data lis loaded I would like it to be read on 3 dynamic text boxes.

I am using .getSelectedItem().data to load the main subject title into  the combo box. So that when an Item is selected within the combo box it's content is displayed within 3 textboxes.

Here is the XML content

----------------------------
<?xml version="1.0" encoding="iso-8859-1"?>

<ITEMS>
      <ITEM>
            <LABEL>Label 1</LABEL>
            <DATA1>Data 1</DATA1>
              <DATA2>Data2</DATA2>
              <DATA3>Data3</DATA3>

      </ITEM>
      <ITEM>
            <LABEL>Label 2</LABEL>
                <DATA1>Data 1</DATA1>
              <DATA2>Data2</DATA2>
              <DATA3>Data3</DATA3>
      </ITEM>
      <ITEM>
            <LABEL>Label 3</LABEL>
                <DATA1>Data 1</DATA1>
              <DATA2>Data2</DATA2>
              <DATA3>Data3</DATA3>
      </ITEM>            
</ITEMS>
-------------------------------
The question is: How to read this XML using the getSelectedItem().data


onChangeCombo = function (component_cb)
{
      combodata_txt.text = myCombo_cb.getSelectedItem().data;
}
0
yaney00074
Asked:
yaney00074
  • 5
  • 2
1 Solution
 
ellandrdCommented:
try it:

combo_cb.setEnabled(false);
data_xml = new XML();
data_xml.ignoreWhite = true;
data_xml.path = this;
data_xml.onLoad = function(ok)
{
     this.path.combo_cb.setEnabled(true);
     if (ok) {
          var nodes = this.firstChild.childNodes;
          for (var i = 0; i < nodes.length; i++) {
               this.path.combo_cb.addItem(nodes[i].attributes.label, nodes[i].attributes.data);
          }
          this.path.combo_cb.setChangeHandler("changeData");
          this.path.changeData(combo_cb);
     } else {
          this.path.combo_cb.addItem("no data found");
          this.path.combo_cb.setEnabled(false);
     }
};
function changeData(_cb)
{
     this.newUser = _cb.getSelectedItem().data;
}
data_xml.load("xml/combodata.xml">http://www.dfgsgsdfgsdfg.com/xml/combodata.xml");
submitBTN.onRelease = function()
{
     if (!this._parent.username.length) {
          this._parent.status = "Please enter a username";
     } else {
          if (!this._parent.email.length ||
               this._parent.email.indexOf("@") == -1 ||
               this._parent.email.indexOf(".") == -1 ||
               this._parent.email.indexOf("com") == -1) {
               this._parent.status = "Please enter a valid email";
          } else {
               if (this._parent.email.length < 7) {
                    this._parent.status = "Please enter a valid email";
               } else {
                    this._parent.status = "Loading...Please wait...";
                    this._parent.newUser = new LoadVars();
                    this._parent.newUser.path = this._parent;
                    this._parent.newUser.username = this._parent.username;
                    this._parent.newUser.email = this._parent.email;
                    this._parent.newUser.timeZone = this._parent.combo_cb.getSelectedItem().data;
                    this._parent.newUser.onLoad = function(success)
                    {
                         if (success) {
                              this.path.status = "Complete";
                         } else {
                              this.path.status = "Error";
                         }
                    };
                    this._parent.newUser.sendAndLoad("http://www.dfgsfgsdfg.com/scripts/register.php", this._parent.newUser, "POST");
               }
          }
     }
};


you will have to change a few bits to suit your self etc etc but it should do the trick and at least let you see how its done...
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
yaney00074Author Commented:
Thanks for helping.. unfortunately it' not working..

To make things simple., here is the sample file:
http://vuaney.com/project7/it4sme.htm/sample.zip


Take a look and it will help you see what I mean
0
 
yaney00074Author Commented:
Thanks for helping.. unfortunately it' not working..

To make things simple., here is the sample file:
http://vuaney.com/project7/sample.zip


Take a look and it will help you see what I mean
0

Featured Post

[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now