I have a function which is giving me the class type of an object that I pass in.
public function getClass(obj:Object):Class {
return Class(getDefinitionByName(getQualifiedClassName(obj)));
}
Now if I do this
trace(getClass(panelStack[0]));
I get [class InfoPanel] in the output window which is correct
But if I do this
trace(getClass(panelStack[0]) is InfoPanel);
I get false, but I’m expecting true.
Could anyone please point out what I’m doing wrong here. I’m just about to tear the last parts of my hair out!!!
Thanks,
Mark
You’re almost there, just remove the
getClass()call. Try this instead:The
isoperator can be used with any variable or expression to determine if it is a member of a particular data type. When you had made the call togetClass()you were essentially testing against completely different instance.