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

Input Text to Dynamic Text in All Caps

Community Beginner ,
Oct 17, 2009 Oct 17, 2009

I have two text boxes. An input text box you type into and then a dynamic text box that shows whatever you wrote in the Input box in a different font.

I want the output box to be in all caps. I've done some searching and it looks like there is some AS2 for this:

textOutput.writtentext.text.toUpperCase();

Where:

textOutput is the instance name of the output dynamic box

writtentext is a variable that gets passed

But it doesn't work. How can I get this UpperCase thing to work?

-Kirk

TOPICS
ActionScript
2.4K
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

LEGEND , Oct 17, 2009 Oct 17, 2009

That's as simple as it needs to be, though I don't know what you're doing for the actionscript side of things.  Here is a link to a file I made as an example for you as a Flash 8 file where all you need to do is type into the left (input) textfield and the right textfield converts it to all caps as you type...

http://www.nedwebs.com/Flash/AS2_to_Caps.fla

Translate
LEGEND ,
Oct 17, 2009 Oct 17, 2009

Based on what you described, I think what you want is...

textOutput.text = String(writtentext).toUpperCase();

You could also use the "inputtextfieldname.text" in place of written text, substituting your instance name where it's hopefully obvious

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 Beginner ,
Oct 17, 2009 Oct 17, 2009

That didn't work for me. Not sure what I am doing wrong.

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
LEGEND ,
Oct 17, 2009 Oct 17, 2009

Did you also try it using the input textfield.text instead of the variable like I explained?

Beyond what you described, I can't imagine what else you might have done.  If it helps, the toUpperCase() method is a method of the String class, not a textfield method, which is why I used the String(variable).toUpperCase();... just to insure it is treated as a String.

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 Beginner ,
Oct 17, 2009 Oct 17, 2009

I think I am doing something more basic than what you are writing.

I created two boxes on my stage, an input and dynamic. In the variable portion of the inspector I put the same name in each.

I'm assuming what you wrote is all AS. Not sure how to translate that into what I've done.

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
LEGEND ,
Oct 17, 2009 Oct 17, 2009

Maybe I can save you some anguish.... go to the properties panel and get rid of the var names you entered.  They are unreliable things and are best not used.  Instead, assign the textfields instance names.  If you name the input texfield "inText" and the other one "outText", then you can get the output textfield to display the input textfield's text in caps using...

outText.text = String(inText.text).toUpperCase();

(I hope).

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 Beginner ,
Oct 17, 2009 Oct 17, 2009

Sorry, that isn't working for some reason. My flash file is really simple. One frame. An action layer with your AS. Then a layer with the input and dynamic text with instance names inText outText

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
LEGEND ,
Oct 17, 2009 Oct 17, 2009

That's as simple as it needs to be, though I don't know what you're doing for the actionscript side of things.  Here is a link to a file I made as an example for you as a Flash 8 file where all you need to do is type into the left (input) textfield and the right textfield converts it to all caps as you type...

http://www.nedwebs.com/Flash/AS2_to_Caps.fla

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 Beginner ,
Oct 17, 2009 Oct 17, 2009

thanks, this should let me decipher it.

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 Beginner ,
Oct 17, 2009 Oct 17, 2009

Woohoo! it works! Thank you, thank you, thank you.

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
LEGEND ,
Oct 17, 2009 Oct 17, 2009
LATEST

You're welcome

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