>
>
> If you have a very complex app using Director, do you have any advice on
> tracking down MIAW/parent script leaks?  We have various LDMs, MIAWs,
> parent scripts, etc, with data being shared between all of them, and we
> have some leaks that are being very difficult to track down.

My approach:

1) avoid circular references - for asynchronous processes, create the processes as 
local variables, not properties, and pass in the reference to "me" as the callback 
target.

2) in MIAWs - when the MIAW is slated to be forgotten, but before forget() is called, 
clear all references to objects created in the MIAW.  Keep the number of references to 
objects created within a MIAW, but referenced outside that MIAW, to a minimum so that 
you can keep track of
them and be certain to clear them.

3) use a window managing object that maintains a property list of windows whose 
properties are the window names.  only refer to windows through this object.  If you 
need to know the window that should be scoped with a particular callback (ie. with a 
dialogueBox MIAW that needs to
know to which window to send the user's response, the response being sent to an object 
created within that window), then save the window name, not the window.  If the window 
manager returns VOID when you ask for the window of this name, then you know that that 
window has been
forgotten (I didn't follow this rule myself recently, which got me into trouble last 
night).

4) for LDM interfaces - 'tell someWindow to sendSprite(someSprite, #someHandler))' is 
an good way to avoid circular references when LDMs need to communicate with a behavior 
in the movie that houses the LDM.  Use 'tell LDMsprite to 
sendAllSprites(#setCallbackSprite, someSprite,
"window name", "some message")' to tell LDM interface elements which sprite and which 
window to target with their call. someWindow is retrieved from the global window 
manager.  "some message" can be used to direct the tell LDM sprite command to a 
particular interface element.
(Note: this is reliant on the undocumented use of the "tell" command on an LDM 
sprite.)  The difficulty with this is that LDMs are the last sprites to be 
initialized, so one cannot perform the initialization of the callback on beginSprite 
in a sprite that begins in the same frame
as the LDM sprite to be called.  There are a number of alternate methods for setting 
the initial callback data, depending on what the LDM does and when.


I may be leaving something out or confusing something, but I think this is a good 
start.


If anyone would like my window managing system, I would be happy to make it available. 
 It allows for any MIAW to create any window by simply calling a global window 
manager.  The window manager automatically scopes the new() and the forgetting timeout 
object to the stage.



Regards,

Daniel

[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