addEventListener problem

[FONT=Verdana][COLOR=Black](EDIT: I’m using AS 2.0 in Flash CS3…)

[/COLOR][/FONT]I’m trying to use addEventListener to target a text area component inside a movie clip…

This works fine if the text area component is on the root timeline:


var myTextAreaListener:Object = new Object();
myTextAreaListener = function(eventInfo)
{
    trace("It works!");
};
myTextArea.addEventListener("change", myTextAreaListener);

… but my text area component (“myTextArea”) is inside a movie clip named “textAreaHolderClip_mc”. How do I rewrite the above code to target myTextArea inside the textAreaHolderClip_mc movie clip?

I tried:


var myTextAreaListener:Object = new Object();
myTextAreaListener = function(eventInfo)
{
    trace("It works!");
};
_root.textAreaHolderClip_mc.myTextArea.addEventListener("change", myTextAreaListener);

but it doesn’t work. Any ideas?[FONT=Verdana][COLOR=Black]

From other info I’ve found on the internet, it seems that, by default, listeners can’t work with components inside movie clips. Apparently you can make it work but it involves some EventDispatcher thing.

Anyway, it’s a step in the right direction, but it doesn’t solve my problem. So my initial question remains: How do I rewrite my code to target myTextArea inside the textAreaHolderClip_mc movie clip?

Thanks :)[/COLOR][/FONT]