PDA

View Full Version : Repeater Component Problem


manuraj.dhanda
05-09-2007, 02:59 AM
Hello everyone,

I am trying to call a custom component which is a Repeater. As soon as I try to assign a dataprovider to it, it will give me the following error:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at stir/stateHandler()
at Components::mySelection/resultHandler()
at Components::mySelection/___Operation1_result()
at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunctio n()
at flash.events::EventDispatcher/dispatchEvent()
at mx.rpc::AbstractOperation/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()
at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()
at mx.rpc::Responder/result()
at mx.rpc::AsyncRequest/acknowledge()
at ::NetConnectionMessageResponder/NetConnectionChannel.as$40:NetConnectionMessageRes ponder::resultHandler()
at mx.messaging::MessageResponder/result()


The statehandler method, where this problem is occuring is as follows:

public function stateHandler(strState:String, aList:ArrayCollection):void {
this.currentState = strState;
Alert.show("ArrayList is: "+strState+" - "+aList.length);
myResult.resultsRepeater.dataProvider = aList;
}

the problem occurs when I make a call to:

myResult.resultsRepeater.dataProvider = aList;

I am checking the length of aList, it is not null.

myResult --> <comp:Results id="myResult" width="100%" />

and <comp:Results is:

<?xml version="1.0" encoding="utf-8"?>
<mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:comp="Components.*">
<mx:Repeater id="resultsRepeater">
<mx:Label text="This is my Label"/>
<mx:TextArea id="resultTA" width="100%" height="25%" text="{resultsRepeater.currentIndex}"/>
</mx:Repeater>
</mx:Panel>


Please suggest me like where I am making a mistake.

Thanks.
Manu.

manuraj.dhanda
05-10-2007, 05:17 AM
Hii guyz..

I worked on it further and ended up with the finding that, actually it's not the problem of Repeater component.

It is something that I am not able to set the "currentState" of one component from inside the other component.

I tried it different ways like:

classname.currentState = 'someState'; //absolutely not allowed with classname

myClassObj.currentState = 'someState';//not working

myClassObj.setCurrentState("someState",true); //not working

thrown a null property/object reference at run time.

Anyone knows how could we change the currentState of one component from inside the other component???

Thanks
Manu.

Can I
05-10-2007, 08:00 AM
trace / debug your myResult and resultsRepeater references - one of them is null and that's the problem