[mx04pro] XML Connector & binding data HELP!

[font=Arial]Ok, I want to create an array of objects that are assigned values based on an XML document. How would I do this with an XML structure such as:

  <!-- values -->
<!-- etc... -->

How could I make an array, peopleArray, filled with the individual person objects?
This action would ideally be triggered as the frame is loaded (no user intervention required).


That’s a tricky one. I’m not gonna write code cuz I’m lazy, but I’ll tell you the process to the best of my ability.

1)Load the Xml document. Use on onLoad function to make sure that the parsing only begins once the xml has been fully loaded. You might have to use XML.parse() function if you are not loading your XML is a standard way, i.e. from an XML file located on the server.

2)Write a function that loops through your xml file, checking the values of the nodes.

peopleArray = new Array();
if(my_xml.firstChild.childNodes[p] == ‘person’){
peopleArray[p] = my_xml.firstChild.childNodes[p].firstChild;

That code I’m sure has some problems with it and there’s no way you can copy paste it into your document and have it work because I didn’t take your xml structure into account, but it’ll head you in the right direction. Sorry if this makes you more confused.



why not just use the xml? it’s really simple to do.

this should get you started.


Sr. Phantom, thanks for the input. I don’t think I fully understood your code, but I’m studying up on XML objects and think I’ll be taking a similar approach.

I had been attempting to use an XMLConnector component which seems to be very limited to how you can manipulate the XML.

Bodyvisual, thanks for the link. It’s broken right now because it seems they are doing some server maintainance, but I’ll check it out later. I also found that actionscripts.org has a couple XML tutorials. So far I’m getting the impression that the XML object is MUCH more capable than XMLConnector.