View Full Version : Class with XML and Components

05-29-2007, 04:33 PM
Okay, I have an XML document where each child node has a "type" attribute that associates it to a specific kind of component (ComboBox, CheckBox, etc.). And it has other attributes to specify other properties of the component depending on what it is.

I've built a class where you can hand it the XML data (as a string) and a parent movie clip and it will create those components inside that parent MovieClip, lay them out appropriately, and set all of their properties.

This works beautifully in a test app I have created, however, inside the application I'm working on it seems very hit and miss. Sometimes the components will show up and sometimes they won't. This leads me to the following questions.

If an XML object is instantiated with a string value use such as:
var myXML:XML = new XML(valueString);
are you required to wait for a specific event before accessing the childNodes?

Similarly if you create a component using the createClassObject such as:
are you required to wait for a specific event before modifying the properties of that component?

I had the understanding that the answer to both questions was No, and my classes were designed as such, but because of the erratic behavior I'm getting I'm wondering if I'm wrong.

I've attached the classes I'm using if you have any questions.

Thanks in advance,


05-29-2007, 04:49 PM
If you load the XML from an external source, yes you need the event onLoad(success:Boolean) before the XML is parsed. Likewise, you may want to check XML.status to determine that the XML is parsed successfully.

05-29-2007, 10:30 PM
Your script too big for quick answer. try use .x properties instead of ._x. (not sure)