# Controlling motion through user input in Flash 8

**URL:** https://forum.kirupa.com/t/controlling-motion-through-user-input-in-flash-8/185572
**Category:** flash
**Created:** [April 14, 2006, 10:18am UTC](https://forum.kirupa.com/t/controlling-motion-through-user-input-in-flash-8/185572 "2006-04-14T10:18:07Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![bachchun](https://avatars.discourse-cdn.com/v4/letter/b/e56c9b/32.png) [@bachchun](https://forum.kirupa.com/u/bachchun)
#### Post date: [April 14, 2006, 10:18am UTC](https://forum.kirupa.com/t/controlling-motion-through-user-input-in-flash-8/185572/1 "2006-04-14T10:18:07Z")

</div>

How can I make a ball move faster or slower depending on user input values?

---

<div class="post-metadata">

### Author: ![Dauntless](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/dauntless/32/749_2.png) [@Dauntless](https://forum.kirupa.com/u/Dauntless)
#### Post date: [April 14, 2006, 3:05pm UTC](https://forum.kirupa.com/t/controlling-motion-through-user-input-in-flash-8/185572/2 "2006-04-14T15:05:05Z")

</div>

Wauw you are vague!

How does the ball move? ActionScript / Tween ? If AS: What AS ? And what kind of input values do you want?

---

<div class="post-metadata">

### Author: ![bachchun](https://avatars.discourse-cdn.com/v4/letter/b/e56c9b/32.png) [@bachchun](https://forum.kirupa.com/u/bachchun)
#### Post date: [April 15, 2006, 2:37pm UTC](https://forum.kirupa.com/t/controlling-motion-through-user-input-in-flash-8/185572/3 "2006-04-15T14:37:58Z")

</div>

The ball moves vertically up from position 160 to 20 in a straight line. I want it to move faster or slower if the user inputs a value from 1 to 25, 1 being the slowest and 25 fastest. I want to use AS 2.0 and dont know if I can do it with tween. Thanks.

---

<div class="post-metadata">

### Author: ![Dauntless](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/dauntless/32/749_2.png) [@Dauntless](https://forum.kirupa.com/u/Dauntless)
#### Post date: [April 15, 2006, 3:09pm UTC](https://forum.kirupa.com/t/controlling-motion-through-user-input-in-flash-8/185572/4 "2006-04-15T15:09:07Z")

</div>

Something like this?  
(Please be a little more specific next time!)

---

<div class="post-metadata">

### Author: ![bachchun](https://avatars.discourse-cdn.com/v4/letter/b/e56c9b/32.png) [@bachchun](https://forum.kirupa.com/u/bachchun)
#### Post date: [April 17, 2006, 7:17pm UTC](https://forum.kirupa.com/t/controlling-motion-through-user-input-in-flash-8/185572/5 "2006-04-17T19:17:17Z")

</div>

Actually the ball should stop at position 20 rather than bouncing. The user puts a value (1 to 25) , presses a button, and the ball moves from position 180 with designated speed. Thanks again.

---

<div class="post-metadata">

### Author: ![Ayman](https://avatars.discourse-cdn.com/v4/letter/a/dec6dc/32.png) [@Ayman](https://forum.kirupa.com/u/Ayman)
#### Post date: [April 17, 2006, 10:02pm UTC](https://forum.kirupa.com/t/controlling-motion-through-user-input-in-flash-8/185572/6 "2006-04-17T22:02:07Z")

</div>

Well you can simply have something like this (in order to get constant speed, and not any kind of acceleration)

myBall += userInput / ratio

Where ratio determines the amount of deviation in speed (for user input values from 1 to 25)

Does it make sense? You can remove the ratio for now, but later you’ll realize that you need it.
