1 Reply Latest reply on Jun 18, 2010 3:06 AM by mankutimma

    as3 password protection?

    celebritymusic Level 1



      I have a swf editor that loads a swf component.  The swf component gets it's settings from an txt file.


      I only want the user to be able to make changes through the editor if they are password authorised to do so.


      I don't have much experience with password security, and was wondering if you guys could make some suggestions as to the best way to go about this?






        • 1. Re: as3 password protection?
          mankutimma Level 2

          you want users to let make changes to settings inside a swf ?


          if so, in the main swf, before loading the component, have a password option.



          here is a sample code to check password.


          var pass:String = "pass123";
          //submit label
          btn_submit.label = "Submit";
          //event listeners
          btn_submit.addEventListener(MouseEvent.CLICK, checkPassword);
          stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownListener);
          //set focus to input field
          password_txt.stage.focus = password_txt;
          //check input text field to pass string
          function checkPassword(event:MouseEvent):void{
               if(password_txt.text == pass){
                    feedback_txt.text = "Correct.";
                    stage.removeEventListener(KeyboardEvent.KEY_DOWN, keyDownListener);
                    feedback_txt.text = "Incorrect.";
          //enables keyboard enter key
          function keyDownListener(e:KeyboardEvent) {
              if (e.keyCode == Keyboard.ENTER){