Flex External Configuration File
My problem: I have a program in Flex3 that accesses a server. The program itself is on a server and accessed through a web browser. The point is that I don't want to hardcode in the swf file the IP of the server to access, since it changes and for various other reasons...
How can I do that? C开发者_如何学运维an I put a file in the same directory and what then?
To access a config file on the same server as the SWF, you should be able to use an HTTPService
or URLLoader
with a relative URL rather than absolute. You can get fancier (changing ports) by accessing the url
field of your base Application and creating a new absolute URL from that.
If the SWF is hosted separately from the HTML, you can use BrowserManager
url to build your config url instead.
See this article: Externalizing Service Configuration using BlazeDS and LCDS
It will also work for HTTPService with some minor modifications.
精彩评论