Hi,

make sure that when your programs flow reachs to:

  Alert.show("No users found. Create a new one?", "Program
Alert", 3, this, alertClickHandler);
                userDG.dataProvider.removeAll ();

userDG and userDG.dataProvider must exists and has to be instantiated. The error you're getting means that at some point at SearchMan
ager_Search_User_Result you're trying to read some property or execute some method on an object wich is null.

Best
X.


On 9/4/06, Jeremy Rottman <[EMAIL PROTECTED]> wrote:
I have built a simple userManager system, that lets people search for
users in the system. If there are no records returned the user is given
a simple alert window that gives them the choice to add a user. If
records are returned they can double click on the dg and edit the user.
Right now if there are no records returned it gives the error below. It
does not keep the program from working, but it is annoying, once you
click contiue the alert box shows up.

TypeError: Error #1009: Cannot access a property or method of a null
object reference.
     at custom::userSearch/::SearchManager_Search_User_Result()
     at custom::userSearch/___Operation1_result()
     at
flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEven\
tFunction()
     at flash.events::EventDispatcher/dispatchEvent()
     at
mx.rpc::AbstractOperation/http://www.adobe.com/2006/flex/mx/internal::di\
spatchRpcEvent()
     at
mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resu\
ltHandler()
     at mx.rpc::Responder/result()
     at mx.rpc::AsyncRequest/acknowledge()
     at ::DirectHTTPMessageResponder/completeHandler()
     at
flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEven\
tFunction()

Here is my as code.

//*****************USER SEARCH FUNCTIONS
START*****************************

// CALL USER SEARCH METHOD
         private function SearchManager_Search_User(firstName, lastName){
             SearchManager.Search_User(firstName, lastName)
         }

// HANDLE USER SEARCH RESULTS
         private function SearchManager_Search_User_Result(result):*{
             if (result.length >0){
                 userDG.dataProvider = result;

             }
             else{
                 Alert.show("No users found. Create a new one?", "Program
Alert", 3, this, alertClickHandler);
                 userDG.dataProvider.removeAll();
             }
         }

// HANDLE USER SEARCH FAULTS
         private function
SearchManager_Search_User_Fault(event:FaultEvent):void{
             Alert.show("An error occured","Program Error")
         }

// USER SEARCH HANDLER
         private function userSearchHandler(){
             if (firstName.length > 0){
                 SearchManager_Search_User( firstName.text,lastName.text)
             }
             else{
                 SearchManager_Search_User("",lastName.text)
             }
         }

  // EVENT HANDLER FOR ALERT SELECTED OPTION
         private function alertClickHandler(event:CloseEvent):void {
             if (event.detail==Alert.YES)
                    showUserDetail()
             else
                    return;
             }
//*****************USER SEARCH FUNCTIONs
END*******************************






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/




__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to