Hello all, I am stuck on an issue and have run out of ideas to debug
it. (see below)
I am having an issue with a binding. I have a datagrid and the
onchange event triggers the viewstate to change and some
labels/images appear, some of which have data bindings to the
datagrid selection.
I think the problem is that those label/image components within the
view are not initialized and the error is thrown since the data
binding doesnt know those items exist, even though the creationPolicy
is set to all at the top level. (the mxml file that has the viewstate
in it).
Since its not being initialized I get this error each time I click on
a datagrid row.
TypeError: Error #1009: Cannot access a property or method of a null
object reference.
at mx.controls::DataGrid/mx.controls:DataGrid::mouseUpHandler
()[C:\dev\flex_201_gmc\sdk\frameworks\mx\controls\DataGrid.as:4218]
I am positive those items are not being init'd bc i put a initialize
test function that traces the components when they are initialized
just to see if the error is occuring after they are initialized or
before they are. This is happening before and the item never gets
init'd.
private function test(e:Event):void {
trace("item init: " + e.currentTarget);
}
one of the items hidden in a viewstate:
<mx:HBox>
<mx:Label styleName="normalTenBold" text="Status:" width="75"
textAlign="right"/>
<mx:Image source="{(dgUserList.selectedItem.isActive)?
iconStatusOn:iconStatusOff}" width="19" height="20" initialize="test
(event)"/>
</mx:HBox>
The odd thing is that the canvas which is just before the HBox above,
is being init'd, then the error occurs and the image component doesnt
init.
last thing: the error in the debugger pulls up DataGrid.as and points
to line 4217:
if (headerVisible)
pos.y--;
any ideas on how to get past this issue?
- thanks in advance ~ Josh