0

我想使用该代码;

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();
        }

        }
}

我无法添加照片我的声誉很低。但我可以解释。

这是我的网站项目,我有第一个登录屏幕。如果用户名和密码正确程序进入欢迎界面,然后用户可以去更改密码界面。或浏览我的网站。

4

1 回答 1

0

将其存储在 some 中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();
    }

}
于 2013-06-16T08:57:26.260 回答