Eskimo的pia ComboBox组件在调用.selectedItem()时抛出异常

时间:2014-02-05 11:06:12

标签: flex air flex4.6 flex-mobile

我正在开发针对iOS和Android的Flex移动应用程序。 我目前正在使用Eskimo库进行不同的控制,其中一个是我在不同版本的AIR中使用了很长时间。

但是,我已经升级了我的项目以运行最新的AIR 4.0,所以我可以继续使用来自Apple的最新消息(你可以找到一个讨论here的帖子)

从那时起,每当我尝试检索所选项目时,如下所示:

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

我收到以下异常(我无法访问前两句中指定的行):

  

TypeError:错误#1009:无法访问空对象引用的属性或方法。

     

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 \ Adob​​e Flash Builder 4.7 \ XXXXXXX \ src \ XXXX \ presentation \ InvitationPopUp.mxml:168]

有没有人遇到过同样的问题?也许我可以使用仍然有效的.getSelectedLabelDisplay()来解决它,但在我看来它确实不是最干净的解决方案。

修改: 我注意到了一些有趣的东西。当我尝试直接从组件ID获取selectedItem时会出现此问题,如下所示:

myCombo.selectedItem // Exception thrown

但是,如果通过事件处理程序到达相同的ComboBox,则selectedItem()工作正常!

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

1 个答案:

答案 0 :(得分:0)

我认为在调用registeredUsersCombo.selectedItem之前组件没有完全初始化,请显示更多代码