这段代码有什么问题,为什么访问不了??
在FLASH CS3的时间轴上加了以下代码,作用就是要用户点按钮之后在后台访问一个地址,可是程序并没有去访问我指定的URL,高手帮忙看看,什么原因??
function go(event:MouseEvent):void { var variables:URLVariables = new URLVariables(); variables.user= userText.text; variables.password = passwordText.text; var request:URLRequest = new URLRequest("http://localhost:8080/project/login.do?method=login"); request.method = URLRequestMethod.POST; request.data = variables; var loader:URLLoader = new URLLoader(); loader.dataFormat = URLLoaderDataFormat.VARIABLES; loader.load(request); }btn1.addEventListener(MouseEvent.MOUSE_DOWN,go);
function go(event:MouseEvent):void { var variables:URLVariables = new URLVariables(); variables.user= userText.text; variables.password = passwordText.text; variables.method = "login"; var request:URLRequest = new URLRequest("http://localhost:8080/project/login.do); request.method = URLRequestMethod.POST; request.data = variables; var loader:URLLoader = new URLLoader(); loader.dataFormat = URLLoaderDataFormat.VARIABLES; loader.load(request); }
[解决办法]
代码没问题,你debug测试一下