Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8344263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T06:18:36+00:00 2026-06-09T06:18:36+00:00

I need my script to stop and wait until the ‘enter’ key is pressed,

  • 0

I need my script to stop and wait until the ‘enter’ key is pressed, then continue, and if requirments are are not met, to go back and wait again.

its a login screen to a game i am working on, it needs to wait for the user to press enter, then check the provided credidentails and allow/deny them assces.

        //log-in screen
        loginframe = new Login_Frame();
        addChild(loginframe);

        LoginToServer();

        function LoginToServer():Boolean
            {

                inputname = new TextField;
                inputname.type = TextFieldType.INPUT;
                inputname.border = true;
                inputname.x = 200;
                inputname.y = 200;
                inputname.height = 35;
                inputname.width = 545;
                inputname.multiline = false;
                inputname.text = "example";
                loginframe.addChild(inputname);


                inputpass = new TextField;
                inputpass.type = TextFieldType.INPUT;
                inputpass.border = true;
                inputpass.x = 200;
                inputpass.y = 300;
                inputpass.height = 35;
                inputpass.width = 545;
                inputpass.multiline = false;
                inputpass.text = "example";
                loginframe.addChild(inputpass);



                loginframe.addEventListener(KeyboardEvent.KEY_UP, hwndLogKeyboard);

                while (!loginsucsess)
                    {
                        //do nothing *this halts the compiler, takes 30+ seconds for window to appear after execution*
                        //and causes the debugger to shut off (due to delay fault)
                        //so i have three problems
                        //1. this is clearly not an accepable way to do this
                        //2. this code dosnt work, without my debugger i cant fix it
                        //3. even if the code did work, this is a huge project, i cant be goin without my debugger
                    }


                    return true;
            }

        function hwndLogKeyboard(evt:KeyboardEvent):void
            {
                if (evt.keyCode == 13)
                    {
                        if ((inputname.text == "tyler") && (inputpass.text == "shadowcopy"))
                            loginsucsess = true;
                    }
            }

I come from a C++ background where this solution would work just fine, but flash seems to have a problem with twidling its thumbs.

of course ive tryed asking Google, but the search results wernt anything even close to the required topic (me: AS3 wait for keypress – Google: Learn Flash OOP!) <– no, bad Google.

thx in advance;
Tyler

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T06:18:38+00:00Added an answer on June 9, 2026 at 6:18 am

    Blocking UI is not optimal in any language, unless you’re making a text console application.

    Your implementation infinitely loops within your while() statement until max script execution timeout is reached.

    Instead, use asynchronous design patterns:

    package
    {
        import flash.display.Sprite;
        import flash.events.Event;
        import flash.text.TextField;
    
        [SWF(percentWidth = 100, percentHeight = 100, backgroundColor = 0xefefef, frameRate = 60)]
        public class LoginForm extends Sprite
        {
    
            protected var username:TextField;
            protected var password:TextField;
    
            public function LoginForm()
            {
                super();
    
                // construct view
                username = new TextField();
                addChild(username);
    
                password = new TextField();
                addChild(password);
    
                // listen for change events from the text fields
                username.addEventListener(Event.CHANGE, loginChangeHandler);
                password.addEventListener(Event.CHANGE, loginChangeHandler);
            }
    
            protected function loginChangeHandler(event:Event):void
            {
                if ((username.text == "tyler") &&
                    (password.text == "shadowcopy"))
                {
                    // authentication verified - continue
                }
            }
    
        }
    }
    

    When either of the text fields value changes, they are tested for the authentication credentials you have specified. If met, you can continue; otherwise, the application idles without any overhead.

    Having a login button might be more inline with user experience.

    Per debugging, from Flash Professional go to the “Debug” menu and select “Debug Movie”.

    From Flash Builder, right-click on the project application and “Debug as” or press the debug button from the toolbar. Built on Eclipse, you may find it more robust for code editing, debugging, and profiling.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to generate multiple databases to SQL, so I need script/program to automatically
I need a script that will test an input field's contents to see if
I need a script that simply formats a value (eg 4567643) to (4,567,643). No
I need a script to copy only the changed/modified and new files from my
I need a script to convert a comma seperated csv file to an excel
I need a script that inserts a number at some point into a file
I need a script that will insert the current date and time in an
Pretty simple: I need a script that reads the element ij of TWO images
I have a PHP script with infinite loop. I need this script running forever.
I have a fileA with a snippet of code, and I need a script

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.