Flex : difference between using HTTPService and UR

2019-08-22 09:52发布

问题:

What is the difference between using HTTPService and URLRequest for requesting your data from a flex page to servlet

回答1:

URLRequest is the Request Object that contains the URL to load, the post parameters, etc. Usually it is used with more basic loader types than HTTPService, like URLLoader.

HTTPService takes the URL directly as one of its properties, so it doesn't need a URLRequest. Technically, you could use a URLRequest to provide the rest of the "payload," since it is an Object and the request parameter of HTTPService can be any Object.



回答2:

HTTPService is a higher level object, part of the Flex framework, not native to the Flash Player.

It implements various interfaces and can be used as an MXML tag, so you can bind UI controls directly to it. If you are working mostly in MXML, this is easier to use.

URLLoader is native to the Flash Player and is more low level.