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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with setting dynamic text in a button

Status
Not open for further replies.

WildWest

Programmer
Apr 2, 2002
111
US
Hi gurus, I need help ASAP.

My main timeline has a movie clip called "all_buttons"

All_Buttons
---------------
The "all_buttons" movie clip has 6 instances of the same button. This button a dynamic textbox variable name called "txt"

Each button inside 'All_Buttons'
------------------------------------
Each button is name button_1, button_2, button_3, etc... With the behavior of a button.


Problem
------------
When trying the following in Scene 1, Frame 1, Actions layer.....the text doesn't change.

all_buttons.button_1.txt = "Text goes here";

Please let me know what I'm doing wrong.

Thanks for anyone's help in advance!!!

My source code is at:
 
The way to do this is to design your button with a text box on it (as you say you have done). Then create a movie clip out of this (i.e.: by selecting the button on the stage and pressing F8 - or selecting 'create symbol').

You can then put this movie clip as many times as you like onto the stage. Give each instance of the movie clip a different name. (And then group them or whatever you want to do).

Now all you need to do is in your first actions frame put _root.<instance name>.<text box name> = &quot;blah blah blah&quot; and Bob's your man for a full house - as they say.

I think your basic problem (although I haven't looked at your source - sorry) is that you need to change each of your buttons into movie clips to be able to update the text - you can only really update properties on mc's you see... =)

If none of this makes any sense let me know and I'll send you some example code when I get chance!

=)

PetitPal
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top