Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Dynamic text / input text formatting font color

Explorer ,
Jul 09, 2007 Jul 09, 2007
I have a single variable called firstname, and two text fields on the screen, one dynamic text at the top right to display the user's name in a small grey font, and one larger input text field in the middle of the screen. Both have the variable parameter set to firstname, but each field is formatted differently (i.e., color, font size, alignment).

When I type text into the larger field, the font size/color/alignment suddenly changes in the smaller field. How do I preserve the formatting, but update only the variable?
TOPICS
ActionScript
936
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , Jul 10, 2007 Jul 10, 2007
Auto kern was not checked.

I could not figure out how to get Flash to stop copying text formatting along with the text, but I found a simple workaround.

Do not give the text fields variable names. Give them instance names instead, and execute this command when you want to update the value of one with the content of the other:

myTextField1.text = myTextField2.text;

That copies ONLY the text, not the formatting.
Translate
Community Expert ,
Jul 09, 2007 Jul 09, 2007
are you sure the formats are different and there's no actionscript affecting the textfields?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 09, 2007 Jul 09, 2007
Yes. Try this simple experiment: create two Input Text fields both with the same variable name. Format them differently. Now see what happens when you publish and run. How do you get the formatting to be independent for each field?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 09, 2007 Jul 09, 2007
I'm using Flash CS3 with ActionScript2.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 09, 2007 Jul 09, 2007
i see no problem. i used different fonts, font color, font size and alignment with the same textfield variable in one input textfield and one dynamic textfield. also, no problem with 2 input textfields.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 09, 2007 Jul 09, 2007
the problem is caused because you have html-enabled textfields. disable html and you should see no problem.

if you must have html-enabled textfields give them different instance names of use the onChanged method of textfields to have each textfield update the htmlText property of the other.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 09, 2007 Jul 09, 2007
I see the HTML toggle switch on the Properties, but it makes no difference. I also tried this:

_root.textfield.html = false;

But then I get a full HTML dump in my text field.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 09, 2007 Jul 09, 2007
make sure auto kern is NOT ticked. (that also enables html.)
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 10, 2007 Jul 10, 2007
LATEST
Auto kern was not checked.

I could not figure out how to get Flash to stop copying text formatting along with the text, but I found a simple workaround.

Do not give the text fields variable names. Give them instance names instead, and execute this command when you want to update the value of one with the content of the other:

myTextField1.text = myTextField2.text;

That copies ONLY the text, not the formatting.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines