Tutorial :Two different HTTPService classes in Flex



Question:

Why are there two different HTTPService classes in Flex? this and this

And the second one inherits the first one. Why couldn't there be a single class combining the two?


Solution:1

One of the objects (the first link you posted) is the HTTPService Object itself.

The second is the object that wraps the HTTPService object and gives it the additional functionality for the <mxml /> tag.

The two probably weren't combined because you don't necessarily need the implementation of the IMXMLObject and IMXMLSupport interfaces every time you need an HTTService object.


Solution:2

mx.rpc.http.mxml.HTTPService can also handle concurrency while the other can't.

Edit:

Although in the online documentation I see concurrency as a property of both, several sources say thats not true(and my tests didn't work when I first tried using it). Also the concurrency package is only imported into the mxml.HTTPService, not the base rpc class.

Bug Comment Mederator comment on the docs page


Solution:3

There appear to be more error handling features in the URLLoader class. Using MXML to create your HTTPService is not a big difference though.

// ActionScript Style  private function myService():void {     var service:HTTPService = new HTTPService();  ...service.parameters = value;...     service.send();  }  

or

< !-- MXML Style -- >  < mx:HTTPService >  ...< parameters >...  < /mx:HTTPService >  


Solution:4

The first is a member of the mx.rpc.http package and is used in ActionScript code. The other version of the HTTPService class is a sublass of the first and is a member of the mx.rpc.http.mxml package. This is the version you use when you instantiate the object with the tag.

The versions are nearly identical with two significant differences: only the MXML Version implements the showBusyCursor property, which casuses an animated curser top be displayed for the duration of an HTTPService request/response cycle, and the concurrency property, which determines how multiple concurrent requests to the same network resource are handled.

The concurrency property isn't implemented in the version of the HTTPService class typically used in ActionScript because, when using ActionScript you commonly create a new HTTPService object for each new request.

Source: Adobe Flex 3 Bible - David Gassner


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »