How can I set the focus on BUTTON1 when the web page loads, then when the user tabs, go to BUTTON2?
hi Mickormick
explain a little more please:bandit:
We are implementing a kiosk (informational computer) in the lobby of our workplace.
There is NO mouse or keyboard. The user has a rotational knob which he can turn to go back and forth between links/buttons.
(We have our knob setup to acknowledge a turn to the right as a TAB key, and a turn to the left as a Shift-TAB key.)
When the user wants to make a selection, he pushes the knob in.
This works well with static webpages, but I am so new to Flash (and so confused) that I am unable to get this to work properly.
When a page loads, I want my movie to play AND I want the focus to be set on the “Next Page” button.
However, if the user wants to go back a page, I want to be able to let him “turn the knob to the left” and set focus on the “Go Back” button.
Thanks
Hi
i’m going home in a minute so i’ll have a look at it tommorw:bandit:
Hey there,
on (keyPress “<Tab>”) {
if (Selection.getFocus() == “_level0.postal”) {
Selection.setFocus(“_level0.pays”);
} else if (Selection.getFocus() == “_level0.pays”) {
Selection.setFocus(“_level0.phone”);
} else if (Selection.getFocus() == “_level0.phone”) {
Selection.setFocus(“_level0.copieur”);
} else if (Selection.getFocus() == “_level0.copieur”) {
Selection.setFocus(“_level0.courriel”);
} else if (Selection.getFocus() == “_level0.courriel”) {
Selection.setFocus(“_level0.postal”);
}
}
This is an example of some code I used for some forms in flash. (I work for a french cultural centre, hence the name [btw… I know that it being in french should please somebody… heh]). Anyways to get to your question:
so
onClipEvent (enterFrame) {
Selection.setFocus(“_root.thenameofyourbutton”);
}
That sets the focus of your movie to be on thenameofyourbutton (if that’s its name). After that, I would use something similar to what I have above:
on (keyPress “<Tab>”) {
tellTarget (“yourmovieclip”) {
gotoAndPlay(50);}
}
All you need is to put in < Tab > into the keypress quotes and it should go. I’ve never had to do shifttab before, but I think you can just put in tab + shift… but I’m not sure about that part.
Hopefully that helps a bit,
Uth
Uthar,
Thanks for the code. I’m still having troubles, but I’m sure it’s because of my poor Flashing skills.
I think I am approaching this from the wrong angle.
How might you implement a navigation menu (two buttons) that had to be used from strictly keyboard input? No mouse influence.
I have assigned the OnMouseEvent --> KeyPress to my buttons (“NEXTButton” & “BACKButton”). When I test (Control --> Test Movie), the KeyPress works great.
Once I publish, the KeyPress events don’t work.
Any Ideas?
Hey,
Well from your last post I think I did understand your question correctly and most of what I said is still appropriate. There’s probably a few different ways of approaching it mind you, but I think the one I suggested would work. As to what could have make your keypress work when you tested it, and not when you publish… good question, I’m not quite sure.
If you want, you can post the .fla, and I’ll give it a look. Or you can email it to me at [email protected]. (I’m assuming your using flash 5 since this is in the flash 5 forums…)
I’m not guaranteeing I can fix it, but I can sure give it a whirl.
Have a good one,
Uth
Thanks, I’d appreciate that.
Just keep in mind that I am a beginner.
Don’t be too disgusted with my source.
Hey there,
Nah, I’m still a newbie when you consider the experience that’s on this board, so I don’t think I’ll get too critical of what you’ve done
I’ll give it a look tonight/saturday and see what I can do with it.
Laters,
Uth
Hey there,
Sorry about the delayed response, but my computer went down kind of hard on saturday and hasn’t been back up yet, which is why I took until tuesday (monday was a holiday) to respond. I’m pretty sure I have to replace my CPU and perhaps the motherboard as well, not sure yet. Either way I’m sorry I hadn 't gotten to your file by saturday morning when my computer hit rock bottom, and I won’t be able to do much for a few more days.
Sorry again for the mishap.
Uth
Sorry to hear about your computer…
I hope (for your sake) you can get it running soon.
For me, that would be like loosing a limb.
Don’t concern yourself with my project.
Whenever you get a chance is great!
Thanks
hi guys,
i want to implement the tabIndex to some textboxes in my project and i’ve managed to get some of it working thanks to this thread - just wondering if i can get some more help…
ok - this bit works:
onClipEvent(load){
Selection.setFocus("_root.myClip.txt1");
}
next i tried Uthar’s code:
on (keyPress “<Tab>”) {…
and got no further: i get an error here:
Scene=Scene 1, Layer=Layer 1, Frame=1: Line 13: ‘,’ expected
on(keyPress “<Tab>”{
??
===
i originally tried to set the tabIndex order d=by doing this:
_root.myClip.txt1.tabIndex=1;
_root.myClip.txt2.tabIndex=2;
and so on, but that gives me errors too
any help is appreciated
Hey guys,
Ok… I’m going to get down to helping you guys on this since I said I would, and now my computer’s cooperating.
As to jose’s question, I need a little more information.
when you did your keypress, you put in “< tab >” right? (by the way, I put spaces inbetween the left and right ends of the tag because when I put the whole thing without spaces it didn’t show up).
mickormick, I just have to reinstall flash 5, and I’ll be up and away on that file of yours. So tomorrow that’ll get going, and hopefully it’ll be resolved rather shortly.