all groups > flash actionscript > december 2006 >
You're in the

flash actionscript

group:

How to maintain focus in input text box?


How to maintain focus in input text box? AirDynamicAir
12/3/2006 6:02:23 PM
flash actionscript:
I am a complete newbie with Flash MX, ActionScript, and everything in between.
So here's my situation.

I want to make it so the user has to type in a password to move forward with
the Flash presentation.

On my login screen, I have a couple of layers that are animated. Thus, I need
these animations to keep looping. So what did I do? At the end of the
animation, I put in code to GotoAndPlay(1).

Now here's the problem... When someone's trying to type in the password, when
it loops (Gotoandplay), the input box loses focus. To remedy this situation,
for frame 1, I put in the code: Selection.setFocus("txtPassword").

What happens? Everytime it sets focus, everything gets highlighted in the
input text field.

As you can imagine, it is a headache for anyone who is trying to type in the
password because every few seconds, the whole thing gets highlighted and he
accidently types over it.

Any suggestions?
Re: How to maintain focus in input text box? kglad
12/3/2006 11:36:32 PM
1. copy the frames of your looping animation.
2. create a new movieclip and paste those copied frames onto this movieclip's
timeline
3. from your library drag a copy of the above movieclip to frame 1 of your
main timeline and attach a stop() to that frame.
4. place your login textfield and ok button on frame 1 of your main timeline.
5. when ok is pressed (and login) passes some condition direct your main
timeline to frame 20.
AddThis Social Bookmark Button