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

Avatar

Avatar

misery_101

Avatar

misery_101

misery_101

03-04-2008

I am getting a runtime error when I click a button that fires
the addPerson function.

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

at main/addPerson()[C:\Documents and Settings\edunn\My
Documents\Flex Builder 3\workspace2\Test-1\src\main.mxml:178]

at main/___main_Button4_click()[C:\Documents and
Settings\edunn\My Documents\Flex Builder
3\workspace2\Test-1\src\main.mxml:228]



I am new to Action Script - and object programming - so
understand...



I do not understand what I have done wrong here...



I have a result list coming from an external web service that
populates in a datagrid. I'd like to be able to update that
datagrid and then push back to the web service the new array.



Any ideas?????



import mx.rpc.events.ResultEvent;

import mx.rpc.events.FaultEvent;

import mx.collections.ArrayCollection;

import generated.webservices.FxAppiaUserFeaturesService;

import generated.webservices.UserSimRingConfig;

import generated.webservices.SimRingType;



public var plist:ArrayCollection



//Updated Function to populate the data from WS

public function
retrieveUserSimRingConfig(e:ResultEvent):void {

var UsrSimRngCfgNumList:Array = new
UserSimRingConfig().simRingNumberList;

var plist:ArrayCollection = e.result.simRingNumberList;

dgSimPhoneList.dataProvider = plist;





if (e.result.active) {

chboxSimultaneousRingPhones.selected=true;

} else {

chboxSimultaneousRingPhones.selected=false;

}



if (e.result.simRingType == "NO_RING_WHILE_ONCALL") {

chboxSimultaneousRing.selected=true;

} else {

chboxSimultaneousRing.selected = false;

}



}



// Add a person to the ArrayCollection.

public function addPerson():void {

plist.addItem({simRingNumberList:txtPhoneNumber1.text});

}



I posted this in the General Section first by
mistake...

Replies

Avatar

Avatar

riesvantwisk

Avatar

riesvantwisk

riesvantwisk

08-04-2008

Can you tell us what the exact line 178 is??





Ries

Avatar

Avatar

sujikrishna

Avatar

sujikrishna

sujikrishna

15-04-2008

can u explain abt this line

var plist:ArrayCollection = e .
result.simRingNumberList;

Avatar

Avatar

misery_101

Avatar

misery_101

misery_101

21-04-2008

problem resolved..