Wednesday, 11 November 2009

Unloading Modules

Having spent signigicant time investigating module unloading - I want to highlight the importance of removing focus from the module before being unloaded - see Alex Harui's blog enrty on unloading modules -

I tried to set the focus onto something external to my module containing an clickable Advdatagrid however this didn't work so I then ensured that focus couldnt be set on the Advdatagrid not by using ADG.focusEnabled but by setting the selectable property of the ADG to false and then adding event listeners to the column to listen for item click events.

This raised a question finding the item associated with a col when the above properties are disabled the solution was to add a listener to the column as events are still flowing.

the code to get the selctedItem looks like tGhis:

private function firstColumnItemClick(evt:ListEvent):void
selectedItem = AdvancedDataGrid(evt.currentTarget).selectedItem;
//first column
var adgGIR:AdvancedDataGridGroupItemRenderer =
//get the ADGGItemRenderer off the list event
evt.itemRenderer as AdvancedDataGridGroupItemRenderer;

//get the AdvancedDataGridListData open which lives the item property.
var listData:AdvancedDataGridListData = adgGIR.listData as AdvancedDataGridListData;
//set slectedItem to the listData's Item.
selectedItem = listData.item;
//a method to expand the tree node given that you know what item:Object (representing row data)

private function expandDataGridItem(evt:Event):void
rangerReviewsDataGrid.expandItem(selectedItem, true, true);