Hey guys,
I have been making a game and have recently found out about the Combo Box component, I love it and it works really well, except for one thing.
You play the game using the arrow keys, and when you press the arrow keys the character moves, AND it changes the value in the Combo Box, I do not want it to affect the combo box. Is there any way to do this, or a way around it?
Please do not say use the WASD keys or another set of keys as this will not affect it, because this is not an option, they are already being used!
Your actual requirement is that you never wanted to have the focus on combo box. Because if combo box receives the focus then it will update its value when ever navigation keys are pressed. To do so, you have a workaround: When focus is received on combo box, immidiately shift the focus to some other object like an input text box. You can place this input text box besides the stage so that it shall not be visible to the user.
To know more about checking the focus and then shifting it, you may read the onFocus and setFocus events from Flash documentation.
Every frame it executes this code, dummy is an input text, and it works to begin with. But once I change my selection once in the combobox, the focus is no longer with the input text, but with the combo box.
You are quite close...now you have to write a listner even on combo box which will detect focus on the combo box and immidiately transfer the focus on to teh text box....look the documentation for onSetFocus event....
I have attached a sample for your requirement. Run this SWF individually in flash player (not in Flash authoring environment) and please check. Keep clicking tab and you will notice that the focus never goes on teh combo box.
If you open the source FLA you will find some code on 1st frame. Comment that code, publish teh SWF and open it in flash player and hit the tab button and you will notice that focus then goes on to the combo box component.