MX ComboBox Open Direction Bug - Alternative Solution

Written by

Here’s another ComboBox bug (plus potential feature) that irritated me no end with a fix being made difficult due to the relevent methods I needed access to in declared as private (as so many are in mx components [bangs head]!!!).

Bug: ComboBox opens in a specific direction according to its current position on the stage, so the logic is if its too close to the bottom boundary and its content is of a particular height then it will open upwards. This does function but it is inconsistent and the result is a list being cropped with options therefore rendered inaccessible [bad]. Ideally we want to override this logic written in but it’s private so you have absolutely no control over the direction the list opens.

Solution: Ditch the ComboBox and extend PopUpButton (as pointed out by the above link) applying some small modifications as I have done here What I have done completely removes the stage detection and enables you to declare whether the list opens upwards or downwards. It’s a simple solution so don’t expect bells and whistles and essentially fixes the problem I was having leaving you free to modify too your hearts content adding in any other functionality i.e. stage boundary detection etc.