我有一个组合框(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"/>
答案 0 :(得分:2)
为什么不初始化tempObject?
试试这个:
var tempObject:Object = new Object();
tempObject.clientName="Raju";
clientList.selectedItem = tempObject;