Controlling Text Field Properties Flash

Input and Dynamic Text fields have two properties that are accessible with Action Script: .scroll and .maxscroll. Using these properties, you can control the viewable area of a text field that has more lines of text than the text field can show.

  • .scroll: This property can retrieve the current line number (from the top of the field), and it can also move to a new line number in a text field.
  • .maxscroll: This property returns the maximum value of the scroll property for a given text field. You can only retrieve this value you cannot set it.

To understand how these properties work, you need to see how lines are enumerated in a text field. Suppose you had ten lines of text, as a string value for a variable called myText. If you want to use this text in a Dynamic Text field named article, which only has a viewable area of five lines, then the remaining five lines of the myText variable will not be seen in the text field. To make the text field “scroll” to the next line of text by showing lines 2 to 6 (instead of lines 1 to 5), you can create a Button instance, such as a down arrow button, with ActionScript to advance the lines:

The .maxscroll property will return the maximum value for the top line number in a text field. In our previous ten-line text value example, the .maxscroll property would equal 6. If you had 20 lines worth of text in the article text field, then the .maxscroll property would return a value of 16.

Face Book Twitter Google Plus Instagram Youtube Linkedin Myspace Pinterest Soundcloud Wikipedia

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd Protection Status

Flash Topics