So, I have a class in which I create a callback variable like this:
public var callback:Function;
So far so good. Now I want to add an event listener to this class and check for a callback. I do like this:
this.addEventListener(MouseEvent.MOUSE_OVER, function(event:MouseEvent) : void { if (callback) {
This works fine, does not cause any errors, but wherever I test the callback, I get the following warning:
3553: Function value used where type Boolean was expected. Possibly the parentheses () are missing after this function reference.
This listened to me, so I tried to get rid of the warning by checking it for null and undefined. This caused errors. I also cannot create an instance of the function as null.
I know, I know, real programmers only care about errors, not warnings. I will survive if this situation is not resolved. But it bothers me! :) I'm just a neurotic, or is there really some way to check if a real function was created without the IDE cheating on it?
source share