actionscript 3 - How to access other panels in Flex 3 ViewStack? -


I have a view stack with 2 panels:

  & lt; Mx: viewstack id = "seestock 1" height = "243" & gt; & Lt; Mx: panel id = "gridpanel" & gt; & Lt; Mx: DataGrade ID = "Grid" right = "10" left = "10" top = "10" down = "10" width = "300" height = "150" item = "Show description (event)" & Gt; & Lt; Mx: column & gt; & Lt; Mx: DataGridColumn headerText = "ID" dataField = "id" / & gt; & Lt; Mx: DataGridColumn headerText = "summary" dataField = "summary" /> & Lt; / Mx: column & gt; & Lt; / Mx: data grid & gt; & Lt; / Mx: cell & gt; & Lt; Mx: panel id = "detailspanel" & gt; & Lt; Mx: hbox width = "100%" height = "100%" & gt; & Lt; Mx: VBox height = "100%" width = "228" id = "detailsVbox" & gt; & Lt; Mx: label text = "label" id = "itemTitle" /> & Lt; Mx: text text = "text" id = "item sune" /> & Lt; Mx: Data Grid Height = "97" & gt; & Lt; Mx: column & gt; & Lt; Mx: DataGrud column header title = "property" datafile = "call1" /> & Lt; Mx: DataGrid column heading = "value" datafilled = "call 2" /> & Lt; / Mx: column & gt; & Lt; / Mx: data grid & gt; & Lt; / Mx: VBox & gt; & Lt; Mx: image source = "picture / backbutton page" width = "50" height = "50" click = "viewstock 1.selected chald = gridpanel" /> & Lt; / Mx: hbox & gt; & Lt; / Mx: cell & gt; & Lt; / Mx: viewstack & gt;   

I have to click on a grid item in the first panel and then load the data in a panel in the second panel. I can capture the value of the index for the item clicked in the item, but how can I use the details to set the value based on the row information from the grid?

I'm not sure this is what you want, but you can do something like this:

  Private Function Show Description (Event: List Event): Zero {itemTitle.text = event.itemRenderer.data.Id; ItemSummary.text = event.itemRenderer.data.Summary; // assuming that the DataGrid ID is from the Details panel: DetailsDataGrid detailsDataGrid. dataProvider = event.itemRenderer.data.Properties; Viewstack1.selectedChild = DescriptionPanel; }   

You must add ViewStack to a manufacturing policy to do its job.

  & lt; Mx: viewstack id = "viewstack1" height = "243" creation policy = "all" & gt;   

In this way all the panels are going to be created when view-stacks are created (by default they are created only when they are needed). This ensures that you will have a reference to detailsPanel , itemTitle , item ms , etc. before the panel view.

Comments