Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamically changing button text 1

Status
Not open for further replies.

Fion

Vendor
Sep 25, 2003
50
0
0
US
Hello again,
I have been banging my head against a wall for a few hours tring to figure this out. Finally, I decided that I can probably get an answer faster if I just ask...
What I am tring to do is this:
I have a dynamic textfield that I turned into a button. now when I load the program, I want to read text from an XML file, and load that text as the button. I can change the text field of a dynamic textfield, no problem, but I cannot get flash to even identify the text field after I turn the textfield into a button.
Say I have a textfield called testtxt. I can change it by setting testtxt.text
no prolems there...

say I have another textfield called testtxt2. I turn that into a button called testbut. Then I try to change testbut.testtxt.text, but it dosen't work... what am I doing wrong? Am I calling the property wrong?
Thanks for your help
 
You can't directly address buttons in this way - all you can do is assign events to them. What you can do is convert your textfields to movieclips rather than buttons, using their instance name you can target these clips and change the content of the textfield dynamically. Then you can assign onRelease or onPress actions to these clips and they'll work like buttons although you'll have to build your own rollover states etc.
 
Thanks for your answer... I just figured out how to do it though. I was looking as using movie clips, then I finally figured out why I could not address the text inside the button. Then I found out that if I asign the dynamic text a variable, I can access that in the movieclip. I can change the text, but it seems to work only for the inital test, not any of the rollover states, but that works for me, becasue this is a multi-language document, and I like the idea of being able to navigate with other languages, but still display the english at times.
Thanks for your help though!
 
Try setting the button to be blank and then add a text field over it in a higher layer- Then you can edit the text without changing the button.

What you say?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top