2 Replies Latest reply on Jan 10, 2007 4:20 PM by pixelflip

    HTTPService error:  Access of undefined property ...

    pixelflip
      For some reason, I get the error message "Access of undefined property" for each element in the request ... and I only get the error messages if the HTTPService is placed in an MXML Component that is referenced from the main application. I don't get the error messages, however, if the service is placed in the main application.

      What am i missing?

      Here's my httpservice code:


      <mx:HTTPService id="userRequest" url=" http://www.pixeldose.com/guestbook/comments.php" useProxy="false" method="POST">
      <mx:request xmlns="">
      <username>{username.text}</username>
      <emailaddress>{emailaddress.text}</emailaddress>
      <website>{website.text}</website>
      <comments>{comments.text}</comments>
      </mx:request>
      </mx:HTTPService>

      Thanks in advance.

      pixelflip
        • 1. Re: HTTPService error:  Access of undefined property ...
          FlightGuy Level 1
          I'm guessing that username, emailaddress, website and comments are all variables in your application - so they won't be in scope when you're in your MXML component.

          You could
          a) make all of these properties in your component and bind them in your applciation.
          b) make a single object with all these properties, make that object a public property in your component and bind the object from your application.
          c) make a bindable variable in your component called myApplication = Application.application as Application, and add that to the front of your bindings.
          d) make an public XML property in your component and define the XML literal in your application.
          e) put the HTTPService in your application.

          Tim
          • 2. Re: HTTPService error:  Access of undefined property ...
            pixelflip Level 1

            Thanks Tim.

            I actually have a Datagrid container in the MXML component that references these elements and I thought that it would be sufficient. Anyway, just to test it out I added the form container (the same one that was in the application) that references these same elements (for input) and, voila, no more compile errors!

            I thought that was totally unexpected. I merely wanted to be able to populate the datagrid container via the httpservice ... I guess I need to read up some more on these topics.

            Anyway, thanks for your suggestions. I would try it out when I get a chance. I'm a flex newbie so I'm still learning the ropes :)

            pixelflip