# Moving a movieclip continuosly backwards & forwards on the stage with actionscript

**URL:** <https://forum.kirupa.com/t/moving-a-movieclip-continuosly-backwards-forwards-on-the-stage-with-actionscript/283750>\
**Category:** flash\
**Created:** [March 10, 2009, 6:02pm UTC](https://forum.kirupa.com/t/moving-a-movieclip-continuosly-backwards-forwards-on-the-stage-with-actionscript/283750 "2009-03-10T18:02:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![LauraITT](https://avatars.discourse-cdn.com/v4/letter/l/82dd89/32.png) [@LauraITT](https://forum.kirupa.com/u/LauraITT)\
**Post date:** [March 10, 2009, 6:02pm UTC](https://forum.kirupa.com/t/moving-a-movieclip-continuosly-backwards-forwards-on-the-stage-with-actionscript/283750/1 "2009-03-10T18:02:12Z")

</div>

Hi guys,

Does any one know ne good tutorials for this?

I have some code done but it could be all wrong as I am not the best coder at all, just starting out.

Here it is:

package classes  
{  
import flash.display._;  
import flash.events._;  
import flash.display.MovieClip;  
import flash.events.MouseEvent;

```
public class RollableChar extends MovieClip
{
    
    //static const edgeDistance:Number = 80;
    private var character:MovieClip;
    //public var theCharacter:MovieClip;
    
    public function startChar() {
        
        // add to screen characters
        addCharacter();
        
        
    }
    
    public function addCharacter() {
            
            var character = new Object();
            theCharacter.dx = 0.0;
            theCharacter.x = 100;
            theCharacter.dy = 100;
            theCharacter.direction = 1;
            theCharacter.moveRight = true;
            theCharacter.moveLeft = true;
            theCharacter.rollSpeed = 10;
            
            if ((theCharacter.dx &lt; 0) && (theCharacter.x &gt; 100)) {
            addCharacter(); }
        }
        
        public function sit() {
            
        }
    
    
    public function roll(charcter:MovieClip) {
        for(var i:int=0;i&lt;character.length;i++) {
            
            // move
            roll(character*);
            
            // if hit a wall, turn around
            if (character*.hitWallRight) {
                character*.moveLeft = true;
                character*.moveRight = false;
            } else if (character*.hitWallLeft) {
                character*.moveLeft = false;
                character*.moveRight = true;
            }
        }
    }

    
}

```

}
