FORUMS: list search recent posts

input and dynamic text boxes

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Matthew Jeffery
input and dynamic text boxes
on Nov 16, 2012 at 1:37:42 pm

Hi

I hope someone can help. I have recently created an input text box and dynamic text box on the stage which through the variable tab in properties. I would like a user of the page to be able to enter some text in the input box and then for it to appear in the dynamic box in a different font and size. Also I would like the text to only display as capitals. The font that will be used in the dynamic box will be one that is not available on everyones computer and so i may also need to embed it somehow so it works on everyones computer

Please could someone help me as currently both the input box font and dynamic box font stay the same.

cheers
Matt


Return to posts index

demetri tashie
Re: input and dynamic text boxes
on Nov 16, 2012 at 4:16:23 pm

that is not so hard to do - there is only one tricky part - the AL CAPS.

create your 2 textboxes, and in the Properties panel, make one the input text and the other the dynamic text. choose which font and font properties you want through the panel.

embed the fonts (necessary in CS5/6, and recommeneded for other versions if you want to make sure the font you chose willbe used).

give each text box an instance name through the Properties panel ( maybe 'inp_txt' and 'dyn_txt').

set and EventListener - to a button or something else, that will cause the function to work

decalre a variable, a String, for use in the function ( maybe: var strVar:String; )

- the function then takes the String inside the input text box and makes that the text of the 'strVar' variable.
- the function places the input text into the dynamic text which uses an all caps font, or else :
- it needs to iterate throughthe String variable, and replace lower case letters with upper case letters and then places that String/text into the dynamic text field

for the ALL CAPS part, there are at least 2 sure ways that i can think of.

one way is to use a find and replace to replace all lowercase letters with uppercase.

another way would be to use TextFormat Class, and use HTML text ( .htmlText). then the CSS of the font could be a font-variant:small-caps.( this would theoretically work, but i am an not sure that this font property is suuported in actionscript.)

so another way ( a 'trick') is to use and embed a font for the dynamcic text field that only uses capitals. there are some fonts like this - Engravers MT, AlgerianD, BlairMdITC , etc. if you could use one of those fonts, that would easilyensure that it gets displayed as all caps.

here is a simple working example, with written code

i hope that can help you out. i wrote this out quickly, so just ask if it doesn't make sense!


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]