我试图发送三个变量(fname,lname和email)以将它们附加到URL字符串,如http://www.whatever.com?address=&firstname=&lastname=&email=,并将其追踪为“消息失败”我想知道我在这段代码中做错了什么。< / p> Flash中的
'fname_txt','lname_txt'和'email_txt'是输入文本的实例名称
import flash.events.MouseEvent;
import flash.net.URLRequest;
import flash.net.navigateToURL;
mcButton.addEventListener(MouseEvent.MOUSE_UP, onClick);
function onClick(e:MouseEvent):void {
var scriptRequest:URLRequest = new URLRequest("../index.aspx");
var scriptLoader:URLLoader = new URLLoader();
var scriptVars:URLVariables = new URLVariables();
scriptLoader.addEventListener(Event.COMPLETE, handleLoadSuccessful);
scriptLoader.addEventListener(IOErrorEvent.IO_ERROR, handleLoadError);
scriptVars.fname = fname_txt.text;
scriptVars.lname = lname_txt.text;
scriptVars.email = email_txt.text;
scriptRequest.method = URLRequestMethod.POST;
scriptRequest.data = scriptVars;
scriptLoader.load(scriptRequest);
function handleLoadSuccessful($evt:Event):void
{
trace("Message sent.");
}
function handleLoadError($evt:IOErrorEvent):void
{
trace($evt); <----------------UPDATED
}
fname_txt.text = "";
lname_txt.text = "";
email_txt.text = "";
}