Getting progress on POST using HTTPService in Flex/AS3

13,464

Do not use HTTPService. Use URLRequest, URLLoader, and URLVariables.

If your using an HTTPService tag, get ride of it and replace it with a Script tag filled with something like ...


private function forYou() : void{
     var req : URLRequest = new URLRequest("PUT YOUR URL HERE")
     var loader : URLLoader = new URLLoader();
     var params : URLVariables = new URLVariables();
     params.WHATEVER = WHATEVER YOU WANT IT TO BE;
     req.data = params;
     req.method = URLRequestMethod.POST;
     loader.addEventListener(ProgressEvent.PROGRESS, YOUR LISTENER FUNCTION NAME);
     loader.load(req);
}

Assign this function name to the creationComplete attribute of the root tag.

If your not using an HTTPService tag, just get ride of the HTTPService object in your actionscript and use the above code.

Share:
13,464
DEfusion
Author by

DEfusion

Awesome!

Updated on June 05, 2022

Comments

  • DEfusion
    DEfusion about 2 years

    I'm using HTTPService with a POST operation to submit a Base64 encoded file (taken from bitmap data within the app) but I could really do with getting some idea of the progress of the POST operation (e.g. like the FileReference.upload()).

    I don't think this is possible, but it would be awesome if it is (via any means, I'm willing to change my setup to get this).