Problems accessing (nested) Component properties from a class

I am working with actionscript 2.

I have a class that instantiates a movieclip from the library, eg:

debugbar:MovieClip = thing.AttachMovie("debugbar", "debugbar_mc", 999);

so attaching it to the where ever “thing” is - could be movie clip or level0 or whatever, doesn’t matter as “debugbar” is a private variable of the class.

Now the important part - debugbar in the library is a movieclip that contains some components - buttons and textInputs.

The problem comes when trying to access these components.

I would have thought that this would work:

debugbar.input_txt.text = "hello";

in order to set the text of “input_txt”, the instance name of a TextInput component on the timeline of the movie clip (put there in author time).

However, this does not work. Infact, I cannot access any specific “component” properties - they come back undefined.

I can however set and retrieve MovieClip properties for the “input_txt”, such as _x. However there is one added strange thing with this too - setting _visible to false doesn’t seem to work (however perhaps a component by default overrides this).

I also appear not to be able to add event handlers to the component - at least for the usual component events.

I tried casting it to a component, such as:

var temp:TextInput = TextInput(debugbar.input_txt);
trace(temp);

which gave “temp” as null.
However if you trace the thing itself without casting to what it is, it gives the path to correctly.

It almost seems like the components are somehow broken when trying to access them this way - or that they cannot be accessed this way?

The thing is, I was able to access all of this before, when the code to do it was placed on the timeline (frame 1, the only frame) of the debugbar itself, where the components were child instances.
This meant I could just reference them directly too - so input_txt rather than debugbar.input_txt , although that is probably largely irrelevant.

I need to have it in a class though, as I need to pass in certain objects that need to be accessed by the mc.

I am rather baffled as to why all this doesn’t work.
Cheers :wasted: