At 7:44 -0400 2001_07_04, Al Hospers wrote:

>another possibility is to have the sprites all register themselves in
>a list as they come alive & then only send stuff to members of this
>list.

Given that you have a manager-behavior and managed element-behaviors:

I prefer never to use hardcoded spriteNumbers, just as I prefer not 
to use hardcoded memberNumbers.
Therefore I usually let my manager-behavior collect elements by 
sendAllSprites with a list as a parameter, in which the elements 
register themselves.
Letting the manager manage the collection of the group, has the 
advantage, that "he" then knows when all elements have been 
collected, and therefore is able to continue onto performing the 
collective initialization of the complete cluster.

If the manager is in the lowest channel, the elements are not yet 
born on beginSprite.
I often defer the managers "collect" call to the prepareFrame-event, 
when all behaviors have been instantiated, but the stage is still not 
drawn.
Alternatives:
-1:     Implement the prepareFrame handler in the manager and use a 
flag-property to control that the managers initiation is only done 
once.
-2:     Implement the prepareFrame handler in the 
scriptChannelBehavior, and let it broadcast a "begunFrame" event to 
all sprites. Managers can use this event for initialization, knowing 
that all sprites are ready.
-3      on beginSprite, instantiate a helperObject, which starts a 
timeOutObject, receives the prepareFrame event, kills the 
timeOutObject and initializes the manager (or the scriptChannel). 
This avoids the perceived overhead of repeatedly checking flags.
-4      Simply place the manager in the highest channel. I mostly 
find this counterintuitive to the initialization sequence of the 
cluster.

Methods two and three, has the weakness, that the cluster is not 
selfServiced, but relies on the services of a custom framework.

Jakob

[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/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