How can I make the URL specified in the HTTPService of flex to be dynamic?
I have script(called from flex app through HTTPService) and the flex app residing on the server. Now I have to run it on several servers. Server on which i run 开发者_运维技巧it, will contain the flex app and the script called by flex through HTTP service. The problem is in this case i'll have make changes in HTTService URL and build the flex app, each time i run it on different server. Is there a way to specify the URL in some file from which the flx app could read the URL. So each time we run it on diff server we need not to build the flex app, and can just make changes in the file from where the flex app constructs URl dynamically. Any pointers in this directional will be great help
Thanks Sandy
Assuming your folder structure will not change you can use the LocalConnection object
var lc:LocalConnection = new LocalConnection();
trace('lc.domain ' + lc.domain )
This will give you the domain name the server is on then you can hard code the folder structure for the rest of the URL
If you need the full url to the page that the swf is loaded in you could use the externalInterface and call a function that returns "window.location.href" or something like that I have not tested it.
But come to think about it why are you not using relative URLs. Absolute anything = bad
精彩评论