Trace dynamic textfields

How can you trace a dynamic textfield. I have a bunch of them inside movieclips.
You can trace the name of a movie clip when you use code like this.


btn.onRollOver = function() {
trace(this._name);
};

btn is a variable with the path to all my dynamicaly made movieclips. But inside each of these dynamic movieclips is dynamicly created textfields with instance names. But I need a way to trace them how can this be done.
I tried this but did not work.


btn.onRollOver = function() {
trace(this.text._name);
};

Anyone

Well I am not really sure what you are trying to do with that code.

Think about it…

<B>btn</B>.onRollOver = function() {
trace(this._name);
};

Well you already know the name because you had to target it right?

Same situation with the textbox.

btn.onRollOver = function() {
trace(this.<B>myTextBox</B>._name);
};

Ok here is what I have set up


for (var i = 0; i < dressArray.length; i++) {
btn = collectionMenu.CbuttHolder.createEmptyMovieClip(dressArray*+"_mc"+i, i);
btn.createTextField(dressArray*+"_txf", i, 0, 0, 90, 20);
name = btn[dressArray*+"_txf"];
btn._x = center;
btn._y = top+i*spaceY;
name.text = dressArray*;
name.setTextFormat(collectionFrm);
name.selectable = false;
btn.onRollOver = function() {
trace(this.text._name);
};
}

I need a way to find myTextfield that was why I was trying to use _name.


for (item in btn){
	if (btn[item] instanceof TextField) trace(item)
}

This is just giving me the last textfield that was made for every rollOver

What am I doing wrong. If I use what you sugested in my code. It will only trace the last created textfield in the first for loop.


for (var i = 0; i < dressArray.length; i++) {
btn = collectionMenu.CbuttHolder.createEmptyMovieClip(dressArray*+"_mc"+i, i);
btn.createTextField(dressArray*+"_txf", i, 0, 0, 90, 20);
name = btn[dressArray*+"_txf"];
btn._x = center;
btn._y = top+i*spaceY;
name.text = dressArray*;
name.setTextFormat(collectionFrm);
name.selectable = false;
btn.onRollOver = function() {
for (item in btn) {
if (btn[item] instanceof TextField) {
trace(item);
}
}
};
}


your textfields arent in the same movieclip, so instead you’ll have to go through each of the created movieclips and get the textfield out of them. Since you are putting them in their own movieclips, you wouldnt have to give them each a unique name since that is done through the movieclip their in. Then you just cycle through collectionMenu.CbuttHolder and snag the names of the textfields of the movieclips that have them (or just the names of the movieclip itself…) its really hard to say because you never really explained what you are trying to achieve

I want to change the text field color when you rollover the button.
I need to do this without changing the color of the (btn) or mc itself so this is why I wanted when you rollover a button it finds its appropriate text field inside this btn and change the text field color.

Then you just cycle through collectionMenu.CbuttHolder and snag the names of the text fields of the movie clips that have them (or just the names of the movie clip itself…) its really hard to say because you never really explained what you are trying to achieve

Well the first part of this quote is what I’m after. I can easily get the mc _name but I need the text field inside the mc.
Thanks for your patience.