我想使用该代码;
username.text = amazing_text.text;
我尝试在我的登录屏幕类中使用此代码,通常这个类不会看到我的更改器密码场景amazing_text。我尝试工作这个主要类,但这会产生巨大的问题。我想问一下如何在另一个场景中指定“amazing_text”?
package actions {
import flash.display.MovieClip;
import flash.events.*;
import flash.net.*;
import flash.text.*;
public class main extends MovieClip {
public function main ():void {
submit_button.buttonMode = true;
submit_button.addEventListener(MouseEvent.MOUSE_DOWN, checkLogin);
username.text = "";
password.text = "";
}
public function gotoscenetwo():void
{
MovieClip(root).gotoAndStop(1,"welcome");
}
public function checkLogin (e:MouseEvent):void {
if (username.text == "" || password.text == "") {
if (username.text == "") {
username.text = "Enter your username";
}
if (password.text == "") {
password.text = "Enter your password";
}
} else {
processLogin();
}
}
public function processLogin ():void {
var phpVars:URLVariables = new URLVariables();
var phpFileRequest:URLRequest = new URLRequest("php/controlpanel.php");
phpFileRequest.method = URLRequestMethod.POST;
phpFileRequest.data = phpVars;
var phpLoader:URLLoader = new URLLoader();
phpLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
phpLoader.addEventListener(Event.COMPLETE, showResult);
phpVars.systemCall = "checkLogin";
phpVars.username = username.text;
phpVars.password = password.text;
phpLoader.load(phpFileRequest);
}
public function showResult (event:Event):void {
result_text.autoSize = TextFieldAutoSize.RIGHT;
result_text.text = "" + event.target.data.systemResult;
if(result_text.text == "undefined")
{
gotoscenetwo();
username.text = amazing_text.text;
}
else{
stop();
}
}
}
我无法添加照片,我的声誉很低。但我可以解释一下。
这是我的网站项目 我有第一个登录屏幕。 如果用户名和密码正确 程序去欢迎sceen,然后用户可以去更改密码sceen.or浏览我的网站。
答案 0 :(得分:0)
将其存储在某些variable
中,然后将其传递到下一个文本字段,如下所示:
public function showResult (event:Event):void {
result_text.autoSize = TextFieldAutoSize.RIGHT;
result_text.text = "" + event.target.data.systemResult;
if(result_text.text == "undefined")
{
var user_str:String = amazing_text.text;
gotoscenetwo();
username.text = user_str;
} else{
stop();
}
}