I have created my own button class called custom_btn. I created it on the timeline and have exported it for use in ActionScript. I can make an instance of my button, and add it to the screen fine.
The button has a dynamic text field that I would like to change the text in. I have tried to give the text field a name on the time line and the access it when I make the button, but I get an error (I think this is because the name isn’t being saved to the class). How do I change the text?
I want to do something like this:
var myButton:custom_btn = new custom_btn();
myButton.caption = "foo";
So, it turns out that I needed to make the button a MovieClip. Making the button a MovieClip allowed me to give the text field a name. I called the MovieClip “testBtn_mc”, and the dynamic textfield inside it is called button_txt. The code then looks like:
I hope this helps someone.