# Easing Movieclip Tutorial Problem

**URL:** https://forum.kirupa.com/t/easing-movieclip-tutorial-problem/253429
**Category:** Uncategorized
**Created:** [March 1, 2008, 1:39am UTC](https://forum.kirupa.com/t/easing-movieclip-tutorial-problem/253429 "2008-03-01T01:39:23Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Ziul](https://avatars.discourse-cdn.com/v4/letter/z/3be4f8/32.png) [@Ziul](https://forum.kirupa.com/u/Ziul)
#### Post date: [March 1, 2008, 1:39am UTC](https://forum.kirupa.com/t/easing-movieclip-tutorial-problem/253429/1 "2008-03-01T01:39:23Z")

</div>

I’ve got two questions. Here is my code:

```auto
var speed:Number = 1.1;
trace(box.x);
button.addEventListener(MouseEvent.CLICK, moveBox);
function moveBox(evt:MouseEvent) {
    button.addEventListener(Event.ENTER_FRAME, ease);
        function ease(event:Event) {
            [COLOR=Lime]var distance:Number = 400 - box.x;
            var newDistance:Number = distance/speed;
            box.x = 400 - newDistance;[/COLOR]
            [COLOR=Red]//box.x = 400 – (400 – box.x) / speed;[/COLOR]
            }            
    }
    
button.buttonMode = true;

```

Question 1: I’m trying to simplify the math. (Simplified math = [COLOR=Red]red[/COLOR], Math to simplify = [COLOR=SeaGreen]green[/COLOR]). However, when I have only the simplified code and comment out the longer math, I get this error:

[COLOR=Orange]1093: Syntax error.  
1084: Syntax error: expecting rightparen before box.[/COLOR]

Can anyone explain to me why this is happening?

Question 2: Once I press my button to animate the box easing from left to right, I cannot reset the animation. e.g. I would like to press the button and start the animation over again every time I press the button, however, when I press the button again, nothing happens and the box fixes itself on the right after easing. Any help with this would be great.
