2 Replies Latest reply on Nov 11, 2010 2:14 PM by SPGAnne

    Desperate!  Getting Error #1009 with SharedObject

    SPGAnne Level 1

      I am using a SharedObject with Flex that stores a class I have defined as a [RemoteObject].  It is a very complex class with lots of properties that in turn contain (e.g., ArrayCollections and Objects) classes that are also defined as [RemoteObject].   I have been using this set up for many months now, and all of a sudden, when I use the .getLocal to read in the object, I am getting a pile of errors: TypeError: Error #1009: Cannot access a property or method of a null object reference.


      I don't know what I changed/did to cause this.  I've tried restoring back to code before this happened and I am still getting them.  I can't figure out how to use the debugger to see what is causing it.  I have tried using try/catch on the .getLocal method.  I have tried listening for the AsyncErrorEvent on the SharedObject.  But I can't seem to get a breakpoint to happen while the object is being read in.   How do I put a breakpoint into my code somewhere so that I can see what is causing this error.


      Thanks very much in advance to anyone who can help.


      P.S.  I am on Flex 3 using FlexBuilder 3.

        • 1. Re: Desperate!  Getting Error #1009 with SharedObject
          Darrell Loverin Level 4

          Here's a tutorial on using the Flex Builder debugger. http://learn.adobe.com/wiki/display/Flex/3g.+Debug+your+application


          Hopefully this will get you started.




          • 2. Re: Desperate!  Getting Error #1009 with SharedObject
            SPGAnne Level 1

            I will check out tutorial later...one can always pick up new tips and techniques with such things.


            After much flailing around, I found that I could put a breakpoint on every property of the class I was reading in from the SharedObject, this ultimately lead me to discover I could put break points on the mx.collections.ArrayList.readExterna()l method, which (after a LONNNGGGG time since I had many many property chains because the objects are complex) helped me eventually track down my problem....buried way down deep in a setter inside a complex class that was trying to do a .setStyle on a null object.  HATE that when it happens.  ;-)


            At any rate, it was quite a headscratcher to find out where to set the breakpoint to see stuff being streamed in from the SharedObject since there is no source for the flash ObjectInput code.  Fortunately you can catch it one level above that in the ArrayList class.