Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Text in Buttons

Newbie Question!

12:08 am on Mar 7, 2005 (gmt 0)

New User

10+ Year Member

joined:Nov 12, 2004
votes: 0


I'm primarliy an ASPX developer, but I'm trying to learn a little flash. I've struck a problem, and was wondering if anyone could help!?

I have created a flash movie, and a button symbol. There is a text area in my button which I want to be able to change to say something different for each instance of the button.

I tried to do this by changing the text field in the button symbol to Dynamic Text and assigning it an instance name.

Then, from the action for a frame in the main timeline, I tried something like this...

this.ButtonInstance1.TextInstance.text = "This is a test";

... but this does nothing.

This seems like a really simple thing to want to do - anyone got any pointers on how to change the text for each instance of my button symbol?

- Chris

12:20 am on Mar 9, 2005 (gmt 0)

New User

10+ Year Member

joined:Dec 16, 2003
votes: 0

If your text properties of the button (color, weight, etc.) aren't going to change when the button is rolled over or clicked, I would suggest just making the actual button, and NOT the text, the actual button symbol. Then in the movie frames you can just use the text tool to place the different text phrases over the various instances of the symbol.

That's the easiest way I can think to do it, short of having to create a different button symbol for each button.

12:45 am on Mar 9, 2005 (gmt 0)

New User

10+ Year Member

joined:Nov 12, 2004
votes: 0


Thanks for the suggestion, but I only want the text to appear in the over state of the button.

I can't believe that something as simple as this is so complicated! What's the point in creating a 'button' symbol, if every one has to look identical?

- Chris

12:51 am on Mar 9, 2005 (gmt 0)

New User

10+ Year Member

joined:Nov 12, 2004
votes: 0

Actually, I suppose the fact that they look the same is exactly the point!

But you should at least be able to change the text on the buttons?! How far would user interface designers get if every dialog box could have buttons, but they all had to say the same thing!

"Would you like to delete this file? Click YES or YES to continue."

... anyway - this has turned into a rant! Any other ideas?!

- Chris

4:22 pm on Mar 11, 2005 (gmt 0)

New User

10+ Year Member

joined:Nov 17, 2003
votes: 0

You could try using actionscript to change the text of the button. Add a dynamic text box on the button and then just add a script on each button to display different text...
4:27 pm on Mar 11, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Jan 13, 2003
votes: 0

PizdusInc, read the first post ......

Balloon - your AS looks ok, but as your are putting it on the main timeline it maybe the reference to 'this' that is causing the problem.


_root.ButtonInstance1.TextInstance.text = "This is a test";

5:54 pm on Mar 18, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:Feb 13, 2004
votes: 0

I do something like this with buttons in a flash animation I have.

I define the text in my button dynamic text and give it the variable lvlmenu0text

I put an action in the frame (still in the button_)that says

lvlmenu0text = lglmenu0text;

then.. in the instances of the button in my main movie .. I set the variable that's to be displayed.. as an action in the keyframe as:

lilmenu01.lglmenu0text = "some button text here";
lilmenu02.lglmenu0text = "more darn text";

where lilmenu01, lilmenu02 etc.. is the name of the instance of the button.

there are probably easier ways of doing it - but this seems to work for me.. oh.. and I think my button is actually defined as a movie clip - but I'm not sure if this matters..

hope this has helped


7:49 pm on Mar 18, 2005 (gmt 0)

New User

10+ Year Member

joined:Mar 18, 2005
votes: 0

Stratus hit the nail on the head. You can not place text inside a button symbol and have it display dynamic text.It doesnt work. 99.9% of all flashers I know, including myself, build a movieClip with a button inside that. Inside the movieClip is where you put your dynamic text.
So, the AS would be:


The button AS would be:
//whatever action you want to happen




Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members