This is all in 1 function ?  It will never work.  You need to get your
head around the event-driven paradigm.  Make the datagrid a member of
the enclosing class.  Instantiate the grid and hook up event listeners
when your class is created. Execute this everytime a grid row is
selected:
newTextArea.htmlText = newDG.selectedItem.answer;

Kit

On Mon, Sep 8, 2008 at 11:37 AM, Lucas Golden <[EMAIL PROTECTED]> wrote:
> I've created a Datagrid and Accordion dynamically based on my XML (It
> creates a Accordion tab per "header" node and then inside of the Datagrid it
> puts a DG item for each "Question" node inside of the respective "Header"
> node).  Now, I'm wanting to bring up text in to a TextBox based on the
> selected item of the created Datagrid.   Now, I know you would normally do
> this via the text attribute of the TextArea being set to something like
> "text = {DatagridID.selectedItem.
> displayText}".  However, it seems I'm having problems identifying the ID of
> the Datagrid I'm trying to call from.  I've tried setting the Datagrid ID,
> but since it's not defined at compile time, it cannot see it as a valid ID
> to read from if I try to just use it.
>
> The following is the code of the Accordion creation function and I'll mark
> where I need the text to be written out.  Thanks again!
>
> -------CODE-------
>
>         public function buildAccordian(contentArray:ArrayCollection):void
>         {
>             var accordian:Accordion = new Accordion();
>
>
>
>
>                 for (var i:int = 0; i < int(contentArray.length); i++)
>                 {
>
>                     if(contentArray[i].blnIsHeader == 1)
>                     {
>                         var newCanvas:Canvas = new Canvas();
>                         newCanvas.label = contentArray[i].label;
>                         newCanvas.id = "Tab" + contentArray[i].oID;
>                         newCanvas.width = 600;
>                         newCanvas.height = 400;
>
>
>                         DGArray = contentArray[i].Question;
>
>
>
>                         var newDG:DataGrid = new DataGrid();
>                         var newDGCol:DataGridColumn = new
> DataGridColumn("Questions");
>                         newDGCol.dataField = "label";
>                         newDGCol.wordWrap = true;
>                         var cols:Array = newDG.columns;
>                         cols.push(newDGCol);
>                         newDG.variableRowHeight = true;
>                         newDG.selectedIndex = 0;
>                         newDG.columns = cols;
>                         newDG.width = 200;
>                         newDG.height = 350;
>                         newDG.x = 15;
>                         newDG.y = 15;
>                         newDG.id = "QDG" + i;
>                         newDG.dataProvider = DGArray;
>                         newCanvas.addChild(newDG);
>
>                         var newTextArea:TextArea = new TextArea();
>
>                         newTextArea.width = 350;
>                         newTextArea.height = 330;
>                         newTextArea.x = 230;
>                         newTextArea.y = 35;
>
>                         if(DGArray != null)
>                         {
>
>                                        THIS IS WHERE I NEED TO BE ABLE TO
> SET THE TEXT BOX TEXT
>                                        newTextArea.htmlText =
> newDG.selectedItem.answer;  <---THIS DOES NOT WORK.
>
>                         }
>
>                         newCanvas.addChild(newTextArea);
>
>                         var newLabel:Label = new Label();
>                         newLabel.text = "Answer";
>                         newLabel.x = 230;
>                         newLabel.y = 15;
>                         newCanvas.addChild(newLabel);
>
>
>                     }
>
>                     accordian.addChild(newCanvas);
>
>                 }
>
>
>             pageCanvas.addChild(accordian);
>         }
>
>
>
> Thanks again everyone!
>
> Luke Golden
> -------------------------------------------------------------
> To unsubscribe from this list, simply email the list with unsubscribe in the
> subject line
>
> For more info, see http://www.affug.com
> Archive @ http://www.mail-archive.com/discussion%40affug.com/
> List hosted by FusionLink
> -------------------------------------------------------------


-------------------------------------------------------------
To unsubscribe from this list, simply email the list with unsubscribe in the 
subject line

For more info, see http://www.affug.com
Archive @ http://www.mail-archive.com/discussion%40affug.com/
List hosted by http://www.fusionlink.com
-------------------------------------------------------------


Reply via email to