Implicit downcast from Object to boolean

I am running into the warning stating “Implicit downcard from ‘Object’ to ‘boolean’.” And it has been annoying me for quite some time now. I have been searching around and haven’t come up with anything that works well except using the #pragma downcast compiler directive, which isn’t ideal (far better to get rid of the warning than simply say it is okay to have them).

I did find another post (somewhere, can’t actually find it again) on one of the communities that said you should be able to use the build-in System types for all primitives when casting between object type. However, I am finding that it doesn’t work when you do that.

Here is a simplified example of what I am trying to accomplish (with an explanation below):

`var parm:uint = 42;

var captured:System.Boolean = false;

captured = callback(parm) as System.Boolean;

if(captured){

return true;

}

//…`

Basically, I have a callback function passed into this function (top and bottom not displayed - but the gist of it is there) and this function calls the callback, which returns a boolean (well, I am currently trying to return System.Boolean from the callback function) and based on the return value of the callback, I want the current function to do different things (in this case return true off the bat).

Is there any way to cast a Object to a boolean without using #pragma downcast or getting a warning?

Thank you for your time.

this has been bothering me for a couple weeks as well. finally found the answer here.

// instead of this
var callback:Function;

// declare them like this:
var callback:function(uint):boolean;

Yes, in the second one “function” must be lowercase.