To modify a label of a custom made button of type Button (which belongs to the SimpleButton class), assuming that this button is called myLabel, we can do the following:
// we need the Sprite class from the display package and the TextField class from the text package
import flash.display.Sprite;
import flash.text.TextField;
// we declare the states that we want to modify, read/write proprieties of the SimpleButton class
var aStates:Array = ["upState", "overState", "downState"];
var str:String = "My New Text Label";
// we go through the states
for each(var _state:String in aStates){
var ref:* = myButton[_state];
// if the current state has only one child then it'll have the type of that child...
if(ref is TextField) {
ref.text = str;
// ... otherwise it'll be of Sprite type
} else if(ref is Sprite) {
// we go through all children, and when we find the child of TextField type we modify it
for(var i:int=0; i < ref.numChildren; i++) {
if(ref.getChildAt(i) is TextField) {
ref.getChildAt(i).text = str;
break;
}
}
}
}
Do note that the name of the text field is useless to get the reference from a sate of Sprite type using the getChilldByName method - this method will return null. To modify more labels from the same state we need to identify which of texts we're modifying during the children walk-through (we can do it knowing exactly the order of each children in the display list, either setting every text with a dummy text which would help identifying or using other methods).
Using the method presented above you can modify not only TextFields within SimpleButtons, but other types of elements. Anyway, if you need more control and changes over your button you can go and create a custom class based on the MovieClip class.