Index Circumcised

Hi,

In the following the trace:

trace('lines ‘+i+’ : '+lines*);
returns all the nodes in the XML document.

However the trace:

//access/trace
story_txt.text += lines*+field_arr*;
trace(lines*);

returns all indexes sans the last one, also it’s missing fromt the textfield output.


//Make sure the first node is the storyLines node.
	if (this.firstChild.nodeName.toLowerCase() != "storylines") {
		trace("First node wasn't the expected <storyLines>node.");
		return;
	}
	//Yes we do, start the parsing process
	storyLinesNodeXML = this.firstChild.childNodes;
	//Loop through each of the <storyLine>nodes.
	for (var i = 0; i<storyLinesNodeXML.length; i++) {
		//make sure your working with <storyLine>nodes.
		if (storyLinesNodeXML*.nodeName == "storyLine") {
			/*trace(storyLinesNodeXML*);*/
			/*trace(storyLinesNodeXML*.attributes.title);*/
			//initialize a 'shortcut' Array
			lines = new Array();
			// populate it
			for (var i = 0, len = storyLinesNodeXML.length; i<len; i++) {
				lines* = storyLinesNodeXML*.firstChild.nodeValue;
			}
			// access/trace it
			for (i=0, len=lines.length; i<len; i++) {
				trace('lines '+i+' : '+lines*);
			}
		}
	}
}
//Button for creating the story;
create_btn.onRelease = function() {
	var field_arr = new Array(noun_txt.text, bodyPart_txt.text, verb_txt.text, name_txt.text, politician_txt.text, adjective_txt.text);
	for (i=0; i<field_arr.length; i++) {
		//access/trace
		story_txt.text += lines*+field_arr*;
		trace(lines*);
	}
};