?
Solved

How to read XML file Data from flash

Posted on 2005-03-05
7
Medium Priority
?
221 Views
Last Modified: 2010-04-03
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
Comment
Question by:yaney00074
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
7 Comments
 
LVL 16

Expert Comment

by:ellandrd
ID: 13465036
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:yaney00074
ID: 13466080
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
 

Author Comment

by:yaney00074
ID: 13466086
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
 
LVL 16

Expert Comment

by:ellandrd
ID: 13469702
0
 
LVL 16

Accepted Solution

by:
ellandrd earned 500 total points
ID: 13469716
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
The goal of the tutorial is to teach the user how to how to record live broadcast.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question