There is probably an easier way to do this, but I could not find a way
to fire an event that bubbles down stream from a DisplayObject, i.e.
fire an event on all child objects, not parent objects, so I wrote
this function and it seems to work. Again please tell me if there is
a more correct way to do this...
public function
fireChildEventMatch(currentTarget:DisplayObject,eventName:String):void {
var currentTargetUI:DisplayObjectContainer = currentTarget as
DisplayObjectContainer;
if(currentTargetUI != null) {
if(currentTargetUI.hasEventListener(eventName) == true) {
currentTarget.dispatchEvent(new Event(eventName));
// Alert.show("found event match: "+currentTarget.name);
}
for(var i:int=0; i < currentTargetUI.numChildren; i++) {
var currentChild:DisplayObject =
currentTargetUI.getChildAt(i);
fireChildEventMatch(currentChild,eventName);
}
}
}
The function is called like this:
fireChildEventMatch(this,"myEvent");
in place of "this" you can put parent, ParentAppliation.bla, or some
other id, etc.
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/flexcoders/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/