5 Replies Latest reply on May 22, 2008 1:39 AM by dam85

    Problem with a Class

    dam85 Level 1
      hello

      this class works good, the trace() inside completeHandler() print the response of the php page....

      but when i call this class from another .as file i get an error when i try to do event.target.data
      i call the class with:

      private function getUserInvited():void{
      var http:Flex2Php = new Flex2Php();
      http.addEventListener("COMPLETE", eventUserInvited)
      http.connect(" http://www.example.it/test.php", "POST");
      http.setVariables("id_a="+Application.application.userId);
      http.send();
      }
      private function eventUserInvited(event:Event):void{
      trace(event.target.data);
      }

      the error is:
      ReferenceError: Error #1069: Property data not found on inc.Flex2Php and there is no default value.
      at components::UsersList/eventUserInvited()[/home/damiano/lavoro/flex/MyProject/src/componen ts/inc/UsersList.as:38]
      at flash.events::EventDispatcher/dispatchEventFunction()
      at flash.events::EventDispatcher/dispatchEvent()
      at inc::Flex2Php/completeHandler()[/home/damiano/lavoro/flex/MyProject/src/inc/Flex2Php.as:1 8]
      at flash.events::EventDispatcher/dispatchEventFunction()
      at flash.events::EventDispatcher/dispatchEvent()
      at flash.net::URLLoader/onComplete()


      how can i pass the response data from my class (Flex2Php) to the eventUserInvited() ??

      Thanks a lot


      P.S. I don't want to put -> var http:Flex2Php = new Flex2Php(); (public)