AS3 test for class type

I have a function that gives me the class type of the object that I am passing.

public function getClass(obj:Object):Class {
return Class(getDefinitionByName(getQualifiedClassName(obj)));
}

Now if i do that

trace(getClass(panelStack[0]));

I get [InfoPanel class] in the output window, which is correct

But if I do it

trace(getClass(panelStack[0]) is InfoPanel);

I am wrong, but I expect it to be true.

Can anyone point out what I'm doing wrong here. I'm about to tear the last parts of my hair!

Thank,

Mark

+5
source share
2 answers

You are almost there, just delete the call getClass(). Try instead:

trace(panelStack[0] is InfoPanel);

is , , . getClass(), .

+10

is, ==;)

getClass(panelStack[0]) is Class

+6

All Articles