Exactly in your case you probably calling that renderer too soon, before myCombo finished initialization....
--- In [email protected], "honoraryvato" <[EMAIL PROTECTED]> wrote: > > I have a DataGrid. In the headers of the DataGrid I have a > headerRenderer that adds a ComboBox in the header. This part is > working just fine. My question is how can I call a custom method in my > headerRenderer MXML file to change the selectedIndex of the ComboBox? > I can pass variables to the header when it creates it initially but I > need to do it after the header has been initialized. > The code that I have so far that calls the method in the headerRender > looks like this: > (myDataGrid.columns[0] as > DataGridColumn).headerRenderer.newInstance().myMethod(4); > Zero being the first column. Four being the index I want it to go to. > Inside my headerRenderer the myMethod looks like this: > public function myMethod(arg:Number):void{ > myCombo.selectedIndex = arg; > } > If I trace or Alert "arg" it works just fine. But if I make it do > anything with myCombo it gives me an error. > > Does anyone know how to call a method in an headerRenderer and have it > interact with the elements in the headerRenderer? >
