I have an HTML page and it needs to send a POST request for another HTML page that's embedding a Flex application. How can I access the request body from that request in Flex?
3 回答
Even though you say that you are POSTING a request from one HTML page to another; that is not actual what happens. The POST rewuest is sent to a server. That server may then process the request somehow and spit out a new HTML page. But, you cannot POST from one HTML page to another.
Since Flex is a client side technology, you cannot use a POST Request to pass data into it. You also wouldn't be able to access the POST request from Javascript as a parallel.
So, you can have your server process the data, and prepare it to send back to your Flex app. You could do this using FlashVars. If you have a greater data set, then you could somehow save the data to the server, and load it into the Flex app using HTTPService, RemoteObject, or WebService.
you can use FlashVar and External Interface to pass data from parent page to embeded Flex app Please take a look on Communicating with the wrapper
Hopes that Helps
In the end I used a GET request and attached the data to the URL. I know it's ugly, but couldn't find any other way...