Skip to main content
Participant
February 29, 2008
Question

Converting a string into useable code

  • February 29, 2008
  • 3 replies
  • 231 views
Hi, this is hurting my brain, can anyone help me with this, or is it not possible?

I've built my own component that features a dynamic textbox, the text in this textbox has to come from and external XML file. At the moment i have a parameter in the component inspector where you can enter in the XML node location (myXML.firstchild....), this parameter is set to string data type.

At the moment all that is displaying in the textbox is exactly what you put into the parameter. I need to be able to convert this string into a format that actionscript recognises as code. i.e it needs to think that it's a bit of code myXML.firstchild.., so that it loads in the data from the xml. I hope you can understand whats going on, any help would be appreciated.

Cheers
This topic has been closed for replies.

3 replies

kglad
Community Expert
Community Expert
March 1, 2008
:

section1XML["firstChild"]["childNodes"][0]["nodeValue"];
joe1prattAuthor
Participant
February 29, 2008
Thanks for the quick response, but i'm not exactly sure what you mean.

In the input parameter (which is string data type) i want to be able to enter something like this: section1XML.firstChild.childNodes[0].nodeValue;

this is coming into a variable name this.Textbox, do i need to create an Array, and set the first value of it to this variable i.e array[0] = this.Textbox, or is it something else?

Cheers
kglad
Community Expert
Community Expert
February 29, 2008
as long as your xml instance exists you can use array notation to convert a string to an object (like an xml node).