Skip to main content
Participating Frequently
May 12, 2009
Question

How do I bind my XML data to display as the Label text?

  • May 12, 2009
  • 2 replies
  • 1390 views

I have successfully loaded and parsed the XML data that I need. I would now like to build a dynamic symbol that displays the data. It is a list of managers. I would like to display their names, organizations, etc... I assume a label would be best, binding the appropriate XML node to the text attribute of a label? I'm not sure, but that sounds the most reasonable. I can't seem to find and examples of doing this in AS3 however. Does anyone know how I would accomplish this task?

Thanks for any help.

This topic has been closed for replies.

2 replies

May 12, 2009

There's no off the shelf databinding in Flash with AS3. Flash with AS2 does provide databinding components, and Flex has databinding built in to the framework.

Flash with AS3 does have a List component, though, so you may want to look into that. You'd write you own deserializing routine to convert the XML into a dataprovider for the the list component.

R0bert!Author
Participating Frequently
May 13, 2009

Surely there is a way to take values from an XML file and get them to display on the screen in a manner that allows them to be arranged, formatted etc.. That is really all I am trying to accomplish here. What is the best way to do this? I don't think I want a list because I don't want them selectable or to be scrolled. I just want to display text values from my XML file.

kglad
Community Expert
Community Expert
May 13, 2009

using a datagrid or list component would save you the time to create your own display, but if you're particular about how the data are displayed you should arrange the data yourself using textfields.

Ned Murphy
Legend
May 12, 2009

I'm not familiar with your use of the term "binding", so pardon my ignorance there.  If you want to write a list, why wouldn't you use a TextField?

In either case, Label or TextField, you'd assign the text using the text property...

Lbl.text = tField.text = theText;