Many times when you fill text fields with information, the text field just is not large enough to handle it all. You can, of course, make the text field larger, but you can also scroll the text. Scrolling the text will allow you to keep the text field the original size, but still be able to display all of the information. You can scroll a text field two different sets of directions with two different properties. The first is the scroll property, which controls up and down motion and starts at position 0. The second property is the hscroll property, which controls left and right scrolling and also starts at position 0. And both of these properties have limits, which are maxscroll and maxhscroll oddly enough. With these properties, you can control the positioning of text in text fields. Let's jump right in with an example of using the scroll property.
Now test the movie to see that the scroll buttons are working. Now that you can scroll text, let's take a step further and use the Mouse Wheel Event. The Mouse Wheel EventBack in Flash MX, if you wanted to make text fields scrollable by using the wheel mouse, you had to do some fancy JavaScripting. Now it's as easy as hovering over the text field and spinning the mouse wheel. Going back to our preceding example, save the file somewhere, publish it, and then open up either the .html or the .swf file, hover over the text field, and scroll the text field with your mouse wheel. But you don't need a text field to get the event. Here is an example that will actually listen for the event, and tell you how fast and which direction the mouse wheel is going.
Now test the movie (and remember to click on the stage in test mode). When you move the mouse wheel up and down, it will send the speed to the Output window. All positive numbers are scrolling up on the wheel, and all negative numbers are scrolling down on the mouse wheel. In the next section, we are going to cover HTML text in text fields, which isn't really new because we used some HTML text when we were applying StyleSheet objects. |