I'm testing the variable during the FilterManager constructor. I
actually don't have Flex Builder, so I've been using Alert and
ObjectUtil to output information about the variables at run-time, e.g.:
public function FilterManager():void {
super();
Alert.show(test);
this.initDataGrid(dataSource);
this.initFilters();
}
When I try to print out the contents of either "test" or "_test" using
Alert, a blank box pops up. I *am* able to see the contents set from
MXML during the setter:
[Bindable]
public function set test(value:String):void
{
_test = value;
Alert.show(_test);
}
So perhaps the constructor is simply called before the variable has been
set?
Also, I am trying out your suggestion of passing in the ArrayCollection
instead of the DataGrid itself. One of my initial reasons for using the
DataGrid was so that I could have access to the column names that had
been chosen. Perhaps what I'll do is pass in a list of columns names
along with the data.
Does this look about right though?
public class FilterManager extends Form {
[Bindable]
public var dataSource:ArrayCollection;
private var _datagrid:DataGrid;
public function FilterManager():void {
super();
this.initDataGrid(dataSource);
this.initFilters();
}
private function initDataGrid(d:ArrayCollection):void {
_datagrid = new DataGrid();
_datagrid.dataProvider = d;
}
...
<vso:FilterManager dataSource="{Application.application.dataArray}"
test="Test String" width="100%" height="100%"/>
...where "dataArray" is the relevant ArrayCollection.
Thanks!
Keith
--- In [email protected], "valdhor" <valdhorli...@...> wrote:
>
> That should work.
>
> When are you testing the variable test (ie. where is your breakpoint
set) when you get a null value.
>