Checking parent class or type

Hello
I got a situation, where in my class i need to check parent class. I am trying that code inside class MenuItem

public function addItem(item:MenuItem):void {   
            if (item.parent is MenuItem) {code}  // it doesnt work

and here is code how i am adding items to stage

var item3:MenuItem = new MenuItem("title");
var item3_1:MenuItem = new MenuItem("subtitle");
item3.addItem(item3_1);
addChild(item3);

so the idea is, to check, where my class item is added- to the same class or not. In case it called to the same class, i need to change that options.
Please, help me