Before clearing an object you must ensure that any object references 
that are held in property variables are also cleared.  As Warren 
suggests, you should also VOID out any image object references or 
Xtra references.  But, simple variables like strings and integers do 
not need to be cleared - Director will do this for you.

As Warren suggests, the easiest way to do this is to have a 
"destructor" call inside each object.  I typically create a method 
called "mCleanUp" in all my objects.  If the object has no properties 
that are object references, then mCleanup  has no code.

on mCleanUp me
end

However, if an object creates another object, it calls the mCleanUp 
method of that object before voiding the object reference of the 
created object:

on pCreatedObject

on new me
   pCreatedObject = new(script "SomeOtherObjectScript)
   return me
end

on mCleanUp me
   pCreatedObject.mCleanUp()
   pCreatedObject = VOID
end

This is a way to "cascade" the mCleanUp message through all created objects.

More detailed example at the end of Chapter 7 of my EBook:

   http://www.furrypants.com/loope

Irv


At 11:28 AM -0500 8/12/02, Jorge Pe�a wrote:
>Hi Warren,
>
>>  No -- you need  to clear the properties in those objects first.
>Quickest
>>  way is to make a destruct call inside the object that nukes its props.
>>  Then send the destruct command to the object, and then clear the
>object
>>  itself.
>
>Hm, I had no idea about this... Are you absolutely positive that the
>properties need to be VOIDED? I know that in a multilayered structure of
>objects (objects that have objects as properties, those need to be
>VOIDED, not sure about regular properties (e.g. a string)
>
>Cheers,
>



-- 

Lingo / Director / Shockwave development for all occasions. 
          
   (Home-made Lingo cooked up fresh every day just for you.)
[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email 
[EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED]). Lingo-L is for 
learning and helping with programming Lingo.  Thanks!]

Reply via email to