# Actionscript Movement Problems

**URL:** https://forum.kirupa.com/t/actionscript-movement-problems/151369
**Category:** flash
**Created:** [June 15, 2005, 2:16am UTC](https://forum.kirupa.com/t/actionscript-movement-problems/151369 "2005-06-15T02:16:42Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Vexir](https://avatars.discourse-cdn.com/v4/letter/v/a183cd/32.png) [@Vexir](https://forum.kirupa.com/u/Vexir)
#### Post date: [June 15, 2005, 2:16am UTC](https://forum.kirupa.com/t/actionscript-movement-problems/151369/1 "2005-06-15T02:16:42Z")

</div>

I guess in my last thread I wasn’t specific enough.

Allright, so here’s the problem. Many of you know the gravitation tutorial on the site. I applied this to a series of movieclips (text characters converted to symbols), each placed at a different point of time in the timeline. The trouble is, **the movement is irregular and stops in places** , and basically the effect is not working. **The code used on the movieclips is exactly the same as the final piece of code given in the tutorial** , which is this:

```auto
onClipEvent (load) {

	gravity = 2 ;

	// We get the time when the ball is released for the
	// first time. Be careful with the division by 100
	time = getTimer () ;
	time /= 100 ;
	
	floor = 500 ;
	
	bounce = 0.92 ;
	
	// We set the speed of the ball when it is released.
	speedx = 0 ;
	speedystart = 0 ;
}

onClipEvent (enterFrame) {

	// We get the current time (still /100)
	timenow = getTimer () ;
	timenow /= 100 ;
	speedy = gravity * (timenow - time) + speedystart ;
	
	//We move the ball
	this._x += speedx/5 ;
	this._y += speedy/5 ;
	
	if (this._y > floor) {
		this._y = floor ;
		speedy *= -bounce ;
		time = getTimer () ;
		time /= 100 ;
		// reset the timer
		speedystart = speedy ;
		// reset the starting speed
	}
}

```

Here’s a screenshot of the part of the timeline involving the 3 movieclips. The layer names correspond with the text character inside the movieclip, so its “Z” “E” and “N”.

![](http://www.graphicslash.com/asmovementproblem.jpg)
