Hi Danny, Maybe make it a
public var pParent:Clarss; or if you don't want your var to be accessed directly outside the class (best practice) class Clarss { private var _pParent:Clarss; function Clarss(tParent:Clarss) { pParent = (tParent != undefined) ? tParent : this; } public function get pParent():Clarss { return _pParent; } public function set pParent(value:Clarss):Void { _pParent = value; } } HTH Alain -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Danny Kodicek Sent: 22 mars 2007 07:16 To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] Compiling with self-reference Slightly complicated and not terribly important but annoying: It's possible for a class to compile while self-referring: class Clarss { var pParent:Clarss; function Clarss(tParent:Clarss) { if (tParent != undefined) { pParent = tParent; } } } This compiles fine. But with inheritance this no longer works: class Clarss { var pRoot:Clarss2 function Clarss() { } } class Clarss2 extends Clarss { function Clarss2() { } } Now the compiler gets confused by the circular reference and tells me "**Error** C:\...Clarss.as: Line 1: The name of this class, 'Clarss', conflicts with the name of another class that was loaded, 'Clarss'." It's a shame: My object structure has a bunch of objects in a tree structure, all of which inherit the same base class. I'd like them all to have a reference to the top-level node object, but I have to refer to it as an Object instead of its actual class name because otherwise it can't compile. Danny _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.446 / Virus Database: 268.18.17/730 - Release Date: 2007-03-22 07:44 -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.446 / Virus Database: 268.18.17/730 - Release Date: 2007-03-22 07:44 _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com