Skip to main content
Trevor:
Legend
January 21, 2013
Answered

Formating a dynamic text (box) [AS2]

  • January 21, 2013
  • 1 reply
  • 1364 views

Hi,

I have a button called B and a dynamic text box called T

How can I make the text box

     1) change it's fill color?

     2) change it text font?

     3) change the text font style to bold or to regular?

     4) put a colored stroke around the frame?

To place text in the frame upon click of the button I would use

B.onRelease = function() {T.text = "foo"};

Also Is there a way of changing the color of a button on clicking or passing over it?

I need to do this in AS2

Thanks in advance

Trevor

This topic has been closed for replies.
Correct answer Ned Murphy

To manipulate the text/font in the textfield you need to use the TextFormat class and the setTextFormatmethod of the TextField.  The help documentation should have examples if you look there, and you should be able to find helpful information using Google.  Here's a link to the TextFormat class that some one has on the web: http://docs.brajeshwar.com/as2/TextFormat.html

To change the characteristics of the textfield as far as background and border colors go, the TextField class has properties for those that you can set.  Here is a link to the same site as linked above but to the TextField class information.

http://docs.brajeshwar.com/as2/TextField.html

1 reply

Ned Murphy
Ned MurphyCorrect answer
Legend
January 21, 2013

To manipulate the text/font in the textfield you need to use the TextFormat class and the setTextFormatmethod of the TextField.  The help documentation should have examples if you look there, and you should be able to find helpful information using Google.  Here's a link to the TextFormat class that some one has on the web: http://docs.brajeshwar.com/as2/TextFormat.html

To change the characteristics of the textfield as far as background and border colors go, the TextField class has properties for those that you can set.  Here is a link to the same site as linked above but to the TextField class information.

http://docs.brajeshwar.com/as2/TextField.html

Trevor:
Trevor:Author
Legend
January 21, 2013

Thanks a lot Ned

I fixed up the Font issues from your link and will look at the other link later.

Any answer regarding the button changing color?

Trevor

Ned Murphy
Legend
January 21, 2013

If the button is a Button symbol, you can have a rollover effect for it by changing the contents of what is inside the Over frame in the button's inner timeline.  But that will change back when you rollout.

If you want the button to change to a different color and stay that way either due to clicking it or rolling over it, then you need to use a movieclip symbol instead of a button symbol and write the code to control how the movieclip behaves as a button.

You can find tutorials for that if you search Google using terms like "AS2 movieclip as button tutorial"