你可以帮我找出我遇到这些错误的原因
TypeError: Error #2007:
Parameter text must be non-null.
at flash.text::TextField/set text()
at Perdigana_Scene3_fla::MainTimeline/completeHandler()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()
这是我在AS3.0中的代码
import flash.net.URLVariables;
import flash.net.URLRequest;
import flash.net.URLLoader;
import flash.events.Event;
import flash.events.MouseEvent;
//hide processing text
processing_mc.visible = false;
var variables:URLVariables = new URLVariables ;
//build submit button
var varSend:URLRequest = new URLRequest("form_parse.php");
varSend.method = URLRequestMethod.POST;
varSend.data = variables;
//Build the loading variables
var varLoader:URLLoader = new URLLoader ;
varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
varLoader.addEventListener(Event.COMPLETE, completeHandler);
//handler for the PHP Script completion and status;
function completeHandler(event:Event):void
{
//remove processing clip
processing_mc.visible = false;
name_txt.text = "";
password_txt.text = "";
email_txt.text = "";
//Load the response from php
status_txt.text = event.target.data.return_msg;
}
//Add event listener for submit button
submit_btn.addEventListener(MouseEvent.CLICK, ValidateAndSend);
//function ValidateAndSend;
function ValidateAndSend(event:MouseEvent):void
{
//validate fields
if (! name_txt.length)
{
status_txt.text = "Please enter your username";
}
else if (name_txt.length<=5)
{
status_txt.text = "Username must be at least 6 characters";
}
else if (password_txt.length<=5)
{
status_txt.text = "Password must be at least 6 characters";
}
else if (!password_txt.length)
{
status_txt.text = "Please enter your password";
}
else if (!email_txt.length)
{
status_txt.text = "Please enter your email";
}
else
{
//send the data to PHP
processing_mc.visible = true;
//ready the variables in the form for sending
variables.userName = name_txt.text;
variables.userPassword = password_txt.text;
variables.userEmail = email_txt.text;
//send the data to PHP now
varLoader.load(varSend);
}
}
当我在ActionScript 3.0场景中按下提交按钮时,它会输出上面提到的错误请帮助!..提前致谢:)
答案 0 :(得分:0)
您应该在发送之前将变量设置为 varSend :
varSend.data = variables;
varLoader.load(varSend);