[SIZE=2]Hi all!
So, I have some textfields created in a for each loop that are filled with XML data.
They are generated using my xml node Directory, and later searched using the same node to match them up with, and output another node that correlates.
My For Each:
[/SIZE]
[SIZE=2] public function ParseList(xmldata:XML):void[/SIZE]
[SIZE=2] {[/SIZE]
[SIZE=2] var nameList:XMLList = xmldata.Searchtext.Directory;[/SIZE]
[SIZE=2] this.addChild(textContainer); [/SIZE]
[SIZE=2] for each (var nameElement:XML in nameList){[/SIZE]
[SIZE=2] format.font = "Arial MT";[/SIZE]
[SIZE=2] format.size = 22;[/SIZE]
[SIZE=2] format.color = 0x006699;[/SIZE]
[SIZE=2] var currTextField:TextField = new TextField();[/SIZE]
[SIZE=2] currTextField.defaultTextFormat = format;[/SIZE]
[SIZE=2] currTextField.appendText(nameElement.text() + "
");[/SIZE]
[SIZE=2] currTextField.y= 1297 + textContainer.height;[/SIZE]
[SIZE=2] currTextField.height = 40;[/SIZE]
[SIZE=2] currTextField.width = 280;[/SIZE]
[SIZE=2] currTextField.border = true;[/SIZE]
[SIZE=2] currTextField.selectable = false;[/SIZE]
[SIZE=2] textContainer.addChild(currTextField);[/SIZE]
[SIZE=2] trace(nameElement.text());[/SIZE]
[SIZE=2] textContainer.addEventListener(MouseEvent.CLICK, btnListener); [/SIZE]
[SIZE=2] }[/SIZE]
[SIZE=2] }[/SIZE]
[SIZE=2]
My function that matches it up and outputs:
[/SIZE]
[SIZE=2]
private function btnListener(e:Event):void[/SIZE]
[SIZE=2] {[/SIZE]
[SIZE=2] var textTarget:XML;[/SIZE]
[SIZE=2] textTarget = new XML(e.target.text);[/SIZE]
[SIZE=2] trace("This name was clicked:", textTarget);[/SIZE]
[SIZE=2] var Directresultz:String = xmldata.SearchText.(child("Directory").text().toString() == textTarget).location.toString();[/SIZE]
[SIZE=2] trace("location associated with name:", Directresultz);[/SIZE]
[SIZE=2] input.inputTxt.text=e.target.text;[/SIZE]
[SIZE=2] }[/SIZE]
[SIZE=2]
and to get a taste of my xml:
[/SIZE]
[SIZE=2] <Searchtext Wordlookup="name last">[/SIZE]
[SIZE=2] <location>$1</location>[/SIZE]
[SIZE=2] <Name>name last</Name>[/SIZE]
[SIZE=2] <Directory>name last</Directory>[/SIZE]
[SIZE=2] </Searchtext>[/SIZE]
[SIZE=2](I use similar but different nodes as I use different searches pertaining to different things)
So my problem is, with my btnListener function, my name trace comes out correct, and it inputs into my textbox correctly, but nothing comes back for my location text. I have used this similar search (with different nodes) successfully, so I assume my issue here is that the textfields are dynamically created, and are therefore harder to correlate? Any thoughts?
Thanks in advance![/SIZE]