Question

i want use that code;

username.text = amazing_text.text;

i try to work this code in my login screen class and normally this class dont see my changer password scene amazing_text. i try to work this main class but that create huge problem. and i wanna ask how can i specify "amazing_text" in the other scene ?

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

        }
}

i cant add photo my reputation is low. but i can explain.

this is my website project i have first login screen. if user name and password correct program go to welcome sceen and after that user can go to change password sceen.or browse my website.

Était-ce utile?

La solution

Store it in some variable , then pass it to the next text field, like this:

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

}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top