Hi. I'm trying to refer to the TextInput control of a specific row
when the user clicks a button in that row's itemRenderer. I can change
the text in that row's TextInput, but then when I scroll I noticed
that other rows (at random) have their TextInput control set to the
same value. If I scroll up all the way, the item I had edit no longer
has its new value! I also tried reading the value from the "event"
parameter but had same result.
Here's the MXML followed by the click handler,
<mx:DataGridColumn id="myCol" headerText="Test" width="250">
<mx:itemRenderer>
<mx:Component>
<mx:HBox horizontalGap="2">
<mx:TextInput id="txtPhoto" />
<mx:Script>
<![CDATA[
import mx.controls.listClasses.ListBase;
]]>
</mx:Script>
<mx:Button id="btnBrowse" label="Browse" click="
outerDocument.doBrowse( event, this )"/>
<mx:Button id="btnUpload" label="Upload"
click="outerDocument.doSubmit( event )"/>
</mx:HBox>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
// Called when the "Browse" button is clicked
public function doBrowse( event:Event, hbox:HBox ):void
{
var text:TextInput = hbox.getChildAt(0) as TextInput;
text.text = "testing";
return;
}