Skip to content


Flex ComboBox Issues

So today I am working on a few bugs within our application that concerns the mx.controls.ComboBox.

So the problem is that we are loading a list of font names into a combo box for a user to select. We then pass the name of the font to a FontManager (that we have created) that loads the fonts and dispatches a Complete event when it is loaded. We also have a few other custom events that are being dispatched like FONT_READY, and FONT_ERROR. When we compile the app the user can select the combo box then pick a font and the font loads just fine, but if the user starts using the arrow keys to navigate through the combo box really fast, the fonts do not load and if they do, they usually are messed up.

I traced out everything and it was saying the fonts were loaded and the text was displayed, but it wasn’t. I tried loading the two previous fonts to no avail; it always seemed like it was a timing issue. No matter what I did, the user could always move through the list using the arrow keys too fast for the font to load.

So I thought I would just do a fontSelector.enable = false; until the font is ready and then do a fontSelector.enable = true;, (fontSelector being my ComboBox), but this did not work since it still thought the font was being loaded and the user still could cycle through the list regardless. So the issue remains. I even tried to go deeper into a few Adobe classes but that is way to much for this fix and would mess up some other comboBoxes we are using.

So the solution I came up with is to setFocus to something else on the stage. I have a Color Picker on the stage as well, so when the user picks a font, it sets the focus to the ColorPicker colorPicker.setFocus();. Then when the font was ready, I set the focus back on the fontSelector, fontSelector.setFocus();. This seems to solve the issue, and the user still is able to use the arrow keys and move through the ComboBox, but this time the font has time to load and display properly before it lands on the next font in the list.

Now this may be a hack in some peoples eyes, but it works and I could not come up with anything else. If you know of another way to slow down the user’s comboBox selection, please comment here and let me know. If not, I hope this helps someone.

T

Share and Enjoy:
  • Facebook
  • Twitter
  • del.icio.us
  • Google Bookmarks

Posted in Flex.

Tagged with , , , , , .