2 Replies Latest reply on Jun 21, 2008 12:27 PM by |>AoA<|_killa

    Access of undefined property getProjectsService.

    |>AoA<|_killa
      I'm trying to make a function available to other components:

      public static function RefreshProjects():void
      {
      BlurControls();
      getProjectsService.send();
      }

      I get the following errors:
      "Access of undefined property getProjectsService.
      Call to a possibly undefined method BlurControls."

      getProjectsService is a HTTPService in the same component as the above function.
      If i remove the "static" keyword I dont get that error anymore, but my component doesnt see the function anymore.
        • 1. Re: Access of undefined property getProjectsService.
          VarioPegged Level 2
          You cannot refer to non-static members from a static function.

          You could try:

          private static var getProjectsService:HTTPService = new HTTPService();

          Then set the other properties of the service in an init function for example.

          Calling blurControls() (BTW, use lower case for anything but class names) won't work since it's also probably non-static. To make this work, try adding the logic that's defined in blurControls() to refreshProjects() instead.

          TS
          • 2. Access of undefined property getProjectsService.
            |>AoA<|_killa Level 1
            Well, i didnt see your post but I got it fixed :)

            The component that had the function is now made public in the main application when its added as a child(as a viewstate).

            The function isnt static anymore and I call it from another component by doing AA.projectso.refreshprojects();

            the refreshprojects function now looks like:

            public function refreshProjects():void
            {
            blurControls([dgProjects, cmdAddProject]);

            var getProjectsServiceS:HTTPService = new HTTPService(); getProjectsServiceS.addEventListener(ResultEvent.RESULT,getprojectsserviceresult);
            getProjectsServiceS.url = Vars.rooturl+"getprojects.php";
            getProjectsServiceS.useProxy = false;
            getProjectsServiceS.resultFormat = "e4x";
            getProjectsServiceS.request = {uid:Vars.userid};
            getProjectsServiceS.method = "POST";

            getProjectsServiceS.send();
            }