Strange error with is keyword

Ok, so what I’m trying to do is create a function that looks for an Object in an Array with the same Class type as the parameter. This is the function I’m using.


/**
         * Searches for the first Controller in the Entity with the same Class type as the parameter,
         * and if exists, returns an instance of that Controller.
         * 
         * This should only be used if only one of a type of Controller is expected to exist. 
         * For gathering multiple Controllers, use getAllControllersOfType(cls:Class)
         * 
         * @param cls The Class type of the wanted constructor
         * @return The wanted Controller, otherwise null
         */
        public function getControllerOfType(cls:Class):Controller
        {
            for each(var c : Controller in controllers)
            {
                if(c is cls) {
                    trace("c is cls? "+c is cls);
                    return c;
                }
            }
            return null;
        }

In my example, I’m putting in a Controller (for this example, I’m using a PhysicsController) and testing it against a class that has a PhysicsController in it. The trace statement returns “c is cls? true”, and the function is not returning null. Now, in my DocumentClass I’m calling this function again and I’m running a trace statement of

var c:Controller = player.getControllerOfType(PhysicsController);
trace("c is a PhysicsController? "+ c is PhysicsController+ ". c is null? "+c == null)

// returns "c is a PhysicsController? false. c is null? false"

This is also returning the same if I test c as a Controller, but if I test it as an Object, it says it IS an Object. I don’t understand why this is happening.