Eskimo's pia ComboBox component throws exception when calling .selectedItem()

106 Views Asked by At

I'm working on a Flex mobile application targeting both iOS and Android. I'm currently using Eskimo library for different controls, one of them is the I've been using for a long time across different versions of AIR.

However, I've upgraded my project to run the latest AIR 4.0 so I can go along with the latest news from Apple (you can find a thread talking about that here)

And since then, everytime I'm trying to retrieve the selected item, as following:

if (registeredUsersCombo.selectedItem)
{
    // Do something
}

I'm getting the following exception (I don't have access to the lines specified in the two first sentences):

TypeError: Error #1009: Cannot access a property or method of a null object reference.

at com.pialabs.eskimo.components::UniqueChoiceList/get selectedItem()[/Users/fred/Projets/eskimo/piaMobileLib/src/main/flex/com/pialabs/eskimo/components/UniqueChoiceList.as:66]

at com.pialabs.eskimo.components::ComboBox/get selectedItem()[/Users/fred/Projets/eskimo/piaMobileLib/src/main/flex/com/pialabs/eskimo/components/ComboBox.as:158]

at aproove.presentation::InvitationPopUp/checkInvitedUserInformation()[C:\Users\XXXX\Adobe Flash Builder 4.7\XXXXXXX\src\XXXX\presentation\InvitationPopUp.mxml:168]

Did anyone encountered the same issue? Maybe I could work it around using .getSelectedLabelDisplay() which is still working, but it's really not the cleanest solution in my opinion.

EDIT: I've noticed something interesting. The issue is occurring when I try to get the selectedItem directly from the component ID, as in the following:

myCombo.selectedItem // Exception thrown

However, if the same ComboBox is reached through an event handler, the selectedItem() is working fine !

event.currentTarget.selectedItem; // event.currentTarget being the ComboBox, this is working
1

There are 1 best solutions below

1
Đức Minh Phạm On

I think the component does not init completely before you call registeredUsersCombo.selectedItem , Please show more code