Question
Accessing dynamic text inside a simple button?
I have created a button symbol in the library that includes a
dynamic text instance called labelTxt. I've then dragged this onto
the stage to form several buttons called "btn1", "btn2" etc.
I want to be able to change the contents of the text on the buttons dynamically, but I am getting quite a few errors while trying to set the text.
I have tried using (for example)
btn1.labelTxt.text=myString
but am getting errors saying that the property isn't defined.
I would skin a Button and use that but there are 3 quite different styles (skins) of buttons on this particular chart, and I'm not sure how to do that with Buttons. And I keep thinking there must be some easy way to access the labelTxt dynamic text in the buttons I have created.... any help would be very greatly appreciated 🙂
I want to be able to change the contents of the text on the buttons dynamically, but I am getting quite a few errors while trying to set the text.
I have tried using (for example)
btn1.labelTxt.text=myString
but am getting errors saying that the property isn't defined.
quote:
1119: Access of possibly undefined property labelTxt through a reference with static type flash.display:SimpleButton.
I would skin a Button and use that but there are 3 quite different styles (skins) of buttons on this particular chart, and I'm not sure how to do that with Buttons. And I keep thinking there must be some easy way to access the labelTxt dynamic text in the buttons I have created.... any help would be very greatly appreciated 🙂