explorers' club

explorations in dev, science, sci-fi, games, and other fun stuff!

SystemManagers, FocusEvents, and Private Members

Leave a comment

Interesting find: I am able to access private/protected members of certain UIComponents via FocusEvents heard by the systemManager.

How: On my application, I am assigning a listener to the systemManager for FocusEvent.FOCUS_IN events. This means that almost anything in the displayList will ‘bubble up’ to the listener.

systemManager.addEventListener(FocusEvent.FOCUS_IN,
onFocusIn,
false,
EventPriority.DEFAULT_HANDLER,
false);

Conclusion: So the interesting part is when you start to focus in on a TextInput or a TextArea. The evt.target is not the TextInput, but the UITextfield inside the TextInput.  This means you now have access to a protected member of the TextInput.

I am curious to know why certain core (not the package) components aren’t stopping propagation of the FocusEvent from their protected members and dispatching their own.  This would then mean the TextInput and not its protected UITextField would be the target of the event.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s