Properties
Changing properties of the Text Field
As an example we will create a scrolling text. It may be quite useful if you want to display a long text without making the stage large in size.
- Create two buttons with the arrow shape – one pointing up and other pointing down.
- Create a dynamic text box. Extend it down to make it to keep about three lines of the text.
- Assign a variable to the text – for example "a"
- Give this text box a instance name – for example "review" or "mytext"
- In the first and the only frame of the movie assign the long string to the variable, which is a variable in the textbox
a ="Hello this is a test text , we entered it to test how this textbox works"; a = a + " We added several more sentences to the text to make it even bigger";
… and so on. It may be any text you wish. The necessary thing – name of the variable must be the same as for the text box. - Test the movie – the text must appear in the textbox partially displayed – no room.
- Place the following code for one of the buttons. In our example - theText is the name of instance of the dynamic textbox.
on (release) { theText.scroll = theText.scroll - 1; } - For the second button enter the same code but change minus to plus
- Test the movie – when button is clicked it scroll the text to one line up and down respectively.
Pay attention to one fact you need to live with. Some properties are written with precedent underscore – like _x - some are without underscore – like in our example. Make a custom to refer to Flash code if you are not sure.
Explore Flash Help to find what else properties exist for TexField. Along with "appearance" properties such as _width, textColor, border and many other you may find properties which are specific only for the texts such as selectable, wordWrap and others.
Also it's interesting that it's possible to assign or reassign a name of the variable for the textbox or even name of the instance.