With that few nodes, efficiency probably isn't an important
consideration.
 
Gordon Smith
Adobe Flex SDK Team

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Troy Gilbert
Sent: Thursday, February 14, 2008 2:56 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Re: Broadcasting event to all objects on
display list



> It would be unnatural to try to use the event mechanism to propogate
an
> event to all descendants of a tree node. Use a recursive method call
to
> accomplish this.

So, you're thinking something like this (pseudo-code):

for (var i:int = 0; i < this.numChildren; i++)
{
var child:IPropogatableDisplayObject = this.getChildAt(i) as
IPropogatableDisplayObject;
if (child) child.handleEvent(myCustomEvent);
}

Something like that? I guess that would be more efficient... Of
course, the nice thing about the event system is that it already had a
priority system and default cancelling, which are behaviors that I
need as well.

Once I rolled that functionality in, do you think this approach would
still be significantly more efficient than hijacking the event system?
Depth of my tree is 5 to 6 levels, total number of nodes is less than
100, number of events (per node) would be about 10 per frame.

Troy.


 

Reply via email to