If you have ever tried to do component development, you know it can sometimes be a pain because certain methods in the parent class are marked private and are inaccessible to your class. Take for instance the comboBox. When making my custom component (which subclasses comboBox), I wanted to customize some event handling for the listBase. The getDropdown function is where you would (if you could), override the native event handling and plug in your own functionality. But I can’t. Why? Its marked private. “Couldn’t you override the assigned event handlers for the listBase?” Hmmm. Sounds like a plan. Nope. Let’s take a look to see why.
All these guys are marked private instead of protected. Certainly alot of the ‘heavy lifting’ has been for most developers in that they will probably never need to modify these methods. But for a component developer this can pose major problems. In my particular case I wanted to override the dropdown_itemClickHandler in order to intercept and do something to the event getting dispatched. “Couldn’t you just add an eventListener in your subclass and tie in your functionality there?“. Yes, I could but then I would still have the super’s event handler logic taking place, which I don’t want.
So what are the solutions here? Well you have two options at the moment.
- live with it and find another solution.
- copy the super code to a project directory and change the needed code to protected.
I did the latter. It doesn’t sit well with me but I will live. But there is one more thing I did. I suggest if you ever are in the same situation that you save this link. Let Adobe know about it and gripe about it until it gets changed in the next update.
I can understand in the rush to get something out the door that old AS2 programming habits creeped in. But this should be remedied on the next update.