I can't get my flex script to query https://domain.com/caller.php?focus=test123. I'm not trying to get a POST or GET reply. It simply needs to query the specified URL in service.url. So far I've (1) added the mx.rpc.http.HTTPService library, (2) assigned it the variable service: HTTPService, and lastly (3) I called it as seen below. The FLEX script compiles, but the FLEX script doesn't query the specified url on my webserver (note: this is an online web server where the compiled .swf is running in the same path as caller.php and it could also just query caller.php without https://domain.com/ if this is permitted).
<fx:Script>
<![CDATA[
import mx.rpc.http.HTTPService;
// httpservice
private var service:HTTPService
// rest of the code is omitted as its not relevant at all
]]>
</fx:Script>
// rest of the code is omitted as its not relevant at all
public function placeCall(identity:String):void
{
status("Calling " + calleeInput.text + "\n");
service = new HTTPService();
service.url = "https://domain.com/caller.php?focus=test123";
service.send();
// rest of the code is omitted as its not relevant at all
}
// rest of the code is omitted as its not relevant at all
Source if you want to see the omitted code and PRECISELY where I'm inserting HTTPservice: https://github.com/MonaSolutions/MonaClients/blob/master/VideoPhone/src/VideoPhone.mxml#L375
答案 0 :(得分:0)
使用URLRequest解决了我的问题。要了解这些差异,请参阅:Flex : difference between using HTTPService and URLRequest
var urlRequest:URLRequest = new URLRequest("https://www.domain.com/foo.php?focus=bar");
var urlLoader:URLLoader = new URLLoader(urlRequest);