public function Browser(){
var chrome:chromeicon = new chromeicon();
this.parent.addChild(chrome);
chrome.y = 745;
chrome.x = 220;
}
I notice that I cannot reference the parent of the class in the constructor method or any method that is instantiated when I add the object. There must be a way around this problem, but since I’m new to oop I don’t know it.
It’s because a “parent” refers to parent on list of displayed objects. It means that as long as this object is not added as a child to other object, it has no parent, I’m not sure if they need to be added to stage also. You can go around this problem by adding to constructor a listener:
and then construct a function: