Speed of an object by user input in Flash 8

How can I change the speed of a vertically moving ball based on user input values? Also, how can I make it stop when it touches another ball or is at a certain distance from its start?