I bet that is correct.  I have found that it is best to use callLater
for any control manipulation if I have just modified the dataProvider.

 

But, Roger, don't guess.  Debug the code to find out which line is
producing the error.  If you don't have good debugging techniques,
develop them now.

 

Tracy

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Clint Tredway
Sent: Thursday, January 25, 2007 12:07 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Cannot access a property or method of a null
object reference

 

most likely the setting of the selectedIndex is what is causing that
error. Its trying to set a property to a component that doesnt exist
yet.

On 1/25/07, Roger Ross <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> > wrote:

Hello,

Working my way throught the "Training From the Source" turorial and
ran into this error message.

Not sure why I am getting it. I compared my code to the completed code
for the lesson and it looks the same with no problems when I compile it.

TypeError: Error #1009: Cannot access a property or method of a null
object reference.
at Dashboard/::catHandler()
at Dashboard/__catRPC_result()
at
flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEven
tFunction()
at flash.events::EventDispatcher/dispatchEvent()
at
mx.rpc.http.mxml::HTTPService/http://www.adobe.com/2006/flex/mx/internal
::dispatchRpcEvent
<http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent> ()
at
mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resu
ltHandler <http://www.adobe.com/2006/flex/mx/internal::resultHandler> ()
at mx.rpc::Responder/result()
at mx.rpc::AsyncRequest/acknowledge()
at ::DirectHTTPMessageResponder/completeHandler()
at
flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEven
tFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/flash.net:URLLoader::onComplete()

Here is a copy of the code that it has me write with the comboBox that
is to receive the data:


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> "
layout="horizontal"
creationComplete="catRPC.send()">

<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.rpc.events.ResultEvent;

[Bindable]
private var categories:ArrayCollection=new ArrayCollection();

private function catHandler(event:ResultEvent):void{
categories = event.result.catelog.category;
var catObj:Object = new Object();
catObj.name = "All";
catObj.categoryID = 0;
categories.addItemAt(catObj, 0);
catCombo.selectedIndex = 0;
}

]]>
</mx:Script>

<mx:HTTPService id="catRPC"
url="http://www.flexgrocer.com/category.xml
<http://www.flexgrocer.com/category.xml> "
result="catHandler(event)"/>

<mx:ComboBox id="catCombo"
dataProvider="{categories}"
labelField="name"/>

Any Idea's...

Thanks,

Roger




-- 
http://indeegrumpee.spaces.live.com/
<http://indeegrumpee.spaces.live.com/>  

 

Reply via email to