Skip to main content
March 4, 2009
Answered

reset text fields populated with XML to blank

  • March 4, 2009
  • 2 replies
  • 399 views
I have data loading into one of X number of colums when a button is pressed. So button 1 is pressed and text for button one loads into say 4 columns. Then when button 2 is pressed, it may load into 2 columns.

What is happening in this example is the data for button 1's remaining two columns is still showing. Button 2 only has XMl for the 2 columns.

I tried resetting the value of the text as indicated below but it does not remove the colums which are not needed.

_root["but"+b].onRelease = function() {
var path = "buttongroup/but[@id='"+this._name+"']/column";
var myCols:Array = XPathAPI.selectNodeList(myXML.firstChild, path);
for (var j = 0; j<myCols.length; j++) {
_root["c"+j+"_txt"].htmlText = ""
_root["c"+j+"_txt"].htmlText = myCols.firstChild.nodeValue;
}
};
This topic has been closed for replies.
Correct answer
Great. I just put my for loop right above the one in the sample and it worked great. Thanks.

2 replies

kglad
Community Expert
Community Expert
March 5, 2009
you're welcome.
kglad
Community Expert
Community Expert
March 4, 2009
before assigning any text loop through all your textfields and assign their text properties to "".
Correct answer
March 5, 2009
Great. I just put my for loop right above the one in the sample and it worked great. Thanks.