0

我有一个组合框(flex 4),我想设置一个项目。

var tempObject:Object;
tempObject.clientName="Raju";
clientList.selectedItem = tempObject;

这是正确的吗?.但它显示了这个错误

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

我的组合框:

<s:ComboBox id="clientList" width="14%" height="85%"change="clientList_changeHandler(event)"
    dataProvider="{clientListForcombo}" labelField="clientName"
    prompt="Select the  one"/>
4

1 回答 1

2

为什么不初始化 tempObject?

试试这个:

var tempObject:Object = new Object();
tempObject.clientName="Raju";
clientList.selectedItem = tempObject;
于 2013-02-11T06:53:59.857 回答