Affects Version/s: Adobe Flex SDK 4.1 (Release)
Fix Version/s: None
Component/s: Spark: DropDownList
Environment:Affected OS(s): All OS Platforms
Affected OS(s): All OS Platforms
Browser: Other (specify version)
Language Found: English
We have a custom dropdown component (in fact we have a few), and the skin part 'openButton' is optional.
The DropDownController uses the 'openButton', when passed to it to get access to the systemManager. The systemManager then has listeners added to it in addCloseTriggers() and removeCloseTriggers() so that the drop down is shown and hidden when expected.
It would seem that Adobe thought that users may not always want an 'openButton' when utilizing DropDownController and therefore added a setter for systemManager. The DropDownController then should add and remove the listeners successfully.
The problem here is that when these listeners are added and removed the DropDownController truied to access the systemManager on the 'openButton', but it doesn't have an 'openButton' and therefore errors.
There is no need for it to access the systemManager of the 'openButton' as this stage, It could just add the listener to the systemManager. See lines 313 and 343 of spark.components.supportClasses.DropDownController.
Steps to reproduce:
1. Create a class that uses the DropDownController.
2. Instead of setting the 'openButton' property on the DropDownController, set the 'systemManager' property.
3. Open the dropDown from inside your component using openDropDown().
The DropDownController will error trying to access the systemManager or the 'openButton'.
"TypeError: Error #1009: Cannot access a property or method of a null object reference."
The drop down should open successfully with no errors.
Workaround (if any):
Always have an 'openButton' skin part in your skin and hide it from the user.