focusOut + Alert = HUGE Bug!

I searched high and low on these forums and couldn’t find any mention of this, so I hope this will be helpful to somebody! :slight_smile:

This code throws an infinite loop error:

IDListener.focusOut = function(eventObject) {
	Alert.show("blah blah", "ID Error!", Alert.OK, null, myClickHandler, null, Alert.OK);
};
ID.addEventListener("focusOut", IDListener);

But this code works fine:

IDListener.focusOut = function(eventObject) {
	ID.removeEventListener("focusOut", IDListener);
	Alert.show("blah blah", "ID Error!", Alert.OK, null, myClickHandler, null, Alert.OK);
	ID.addEventListener("focusOut", IDListener);
};
ID.addEventListener("focusOut", IDListener);

Thanks to some random guy on a random blog for figuring this out, I was about to lose my mind! :crazy: