Using the Scroll Properties
package
{
import flash.text.TextField;
import flash.events.MouseEvent;
import flash.display.Sprite;
public class Main extends Sprite
{
private var txt:TextField;
public function Main()
{
txt = new TextField();
txt.multiline = true;
txt.wordWrap = true;
txt.text = "Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text ";
txt.height = 100
txt.width = 50;
addChild(txt);
txt.addEventListener(MouseEvent.MOUSE_MOVE, scrollTextField);
}
private function scrollTextField(mouseEvent:MouseEvent):void
{
if (mouseEvent.stageY < 30)
{
txt.scrollV--;
}
if (mouseEvent.stageY > 70)
{
txt.scrollV++;
}
}
}
}
Related examples in the same category