Also, remember that myobj is not the object, it is a variable holding a reference to the object.
So just re-assign a new instance when you need, or set myobj = null; Tracy ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of shaun Sent: Thursday, September 18, 2008 9:30 AM To: [email protected] Subject: Re: [flexcoders] Delete Object - Why does this not work? Mark Easton wrote: > var myobj:Object = new Object(); > delete myobj; > > This returns the error: "Attempt to delete the fixed property myobj. Only > dynamically defined properties can be deleted." > > > > Why is that? So how do I delete myobj when I want to create a new myobj > instance? > var o:Object = new Object(); //o is a fixed property of the current // class o.cheesecake = true; //cheesecake is a dynamically defined property delete o.cheesecake; //can delete a dynamic property. o = null; //can set the fixed to null, garbage collector will //clean up. o = new Object(); // or can just create a new object and the old will //be cleanued up by gc. HTH. cheers, - shaun

