开发者

addEventListener not detecting children (even with bubbles)

there's probably a very simple solution but I'm at my wit's end here.

I have a sprite called content In this sprite there are multiple children that I add and remove (lot's of traffic there) these children dispatch events that bubble.

I have an event listener listening to content and checking for the same type of event.

The order goes

content = new Sprite();
content.addEventListener(AttentionEvent.开发者_如何学编程NEED_FOCUS,focusEventTarget);
content.addChild(new someChildThatDispatches());

this DOESNT work, however.

content = new Sprite();
content.addChild(new someChildThatDispatches());
content.addEventListener(AttentionEvent.NEED_FOCUS,focusEventTarget);

that works..

But the problem with the second model is that I would have to track every time something is changed in the children tree and add the event listener which kinda defeats the entire purpose of bubbling for me.

Does anyone know what I'm doing wrong?

Thank's in advance


strange, it should work with the first model… do you mind posting your custom event manager?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜