View Full Version : How do I set focus
Richard Hanley
12-02-2003, 08:15 AM
I'm trying to make the cursor appear in a text field when I press a button or hotkey. Once it has focus and I can type into it, I need to be able to press the tab key or a hot key to make it appear in another text field. This is driving me mental, can someone help before I lose it????? (_!_)
press F1 and check the setFocus functions...
cobo
Richard Hanley
12-02-2003, 08:40 AM
It's no help whatsoever, thanks. That's precisely the reason I posted this question.
What I need is to know where to put the line
Selection.SetFocus(variable name)
if I want a text field to get focus on startup. From there I need to be able to tab around the screen using the tab key or by using hotkeys (which is another question altogether)
Thanks for any help anyone can give me.
CyanBlue
12-02-2003, 10:33 AM
Howdy and Welcome... ;)
If you want that happen in the beginning of the movie, you should add that line to the first frame of the movie...
If you want that happen in, say, fram 100, then the script should be in frame 100...
If you want that happen when the user press the button, then the script should be in the button handling routine...
Hope that helped you a bit... ;)
Richard Hanley
12-02-2003, 10:49 AM
Cheers CyanBlue thanks for the basic explanation. Plain English is the best way to learn something so I thank you for not getting technical. However I still can get the cursor to appear in the text field (called verbatim) even though the script in the first frame is Selection.SetFocus(verbatim);
stop ();
What am I doing wrong?
CyanBlue
12-02-2003, 10:55 AM
Try this...//Selection.SetFocus(verbatim);
// to
Selection.SetFocus(_level0.verbatim);Make sure that 'verbatim' is the instance name of your text field not the variable name... ;)
Just out of curiosity... Are you testing it within the Flash???
You gotta test your movie within the web browser to see it working as it should be all the time... Flash authoring environment is sorta quirky...
Also, make sure that you have the current Flash player plugins for the Flash and for the web browser... The last line of my signature should tell you what you have right now and where to get it if you need one... ;)
Richard Hanley
12-02-2003, 11:08 AM
Cheers CyanBlue, I'm cracking up here! I still can't get it to work. I launch it in the browser after publishing it but there is no cursor and I can't type into it. I try tabbing but that just goes all over the place.
I have been testing it in flash but the results are the same :o(
CyanBlue
12-02-2003, 11:18 AM
Um... Not sure why it didn't work, but try this xample and see if you can find the difference between mine and yours... ;)
Richard Hanley
12-02-2003, 11:23 AM
Sorry m8 I get Unexpected File Format when I try to open it
CyanBlue
12-02-2003, 11:27 AM
That's in FMX format... What do you have???
Richard Hanley
12-02-2003, 11:30 AM
Flash 5
CyanBlue
12-02-2003, 11:37 AM
That's something you should have mentioned in the first place... :D
File has been updated... ;)
Richard Hanley
12-02-2003, 11:53 AM
Sorry. I still get Unexpected File Format when I open it. I can run it in the player and it works fine, but I can't see the code.
Aaaaaaaaaaaaaaaaaaarrrrrrrrrrrrrrrrrrrrrrrrggggggg gggggggghhhhhhhhhhhhhhh!!!!!!!!!!!!!!!! I'm getting a little frustrated with flash, can U tell?
if your viewing your form in a web page, you will not get the cursor in your flash form as a default... the user must first click anywhere inside the flash movie to give the flash movie focus... otherwise the browser window has focus by default. make since? once the flash movie has focus, you can (maybe) set up a Key Listener to capture the an ALT+?? to execute your Selection.setFocus() code.
thats what this thread was originally about right? capture hotkeys?
Richard Hanley
12-02-2003, 12:41 PM
Cheers TG, yeah it was about getting focus to a text field on startup then being able to tab through in order. I'm reading other people's threads on here and the answers make sense. I must be just missing something obvious. I've tried setting the tabindex but it makes no difference, it just seems to go through in whichever order it feels like.
I understand what you're saying, but I can't get any of it to work.
Thanks for taking the time to answer though.
manuelarean
12-02-2003, 12:52 PM
But maybe the order that textfields are "focus" by the tab key is the instance level.
I read somewhere that this "instance level" is between -16384 and 1048575.
I know that this works with movieclip instances, but I am not sure if It is the same with textfields...
I hope this could help
CyanBlue
12-02-2003, 04:23 PM
Hey, Richard...
I say that you create a sample with your settings in tact, and see if that works for you... If not, you should post the sample so that other people can take a look... ;)
I can't do anything but yapping cuz I just reformatted the hard drive and downloading the IE 6 on 56k... :( But I am sure that somebody will take a look at your example... Good luck... ;)
Richard Hanley
12-03-2003, 06:03 AM
No probs, cheers m8
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.