I don't really use flash, but I've written games in other languages, so I can try to help you but I can't give any actual code. First of all, the object should have attributes x and y (its x-position and y-position) and dx and dy (its horizontal velocity and vertical velocity). When you want it to start moving, set dx and/or dy to something non-zero. When you want it to stop, set dx and dy to zero. To make it keep going, you just have to add dx to x and dy to y every frame. To make it change its horizontal direction, just multiply dx by -1, and to change vertical direction, multiply dy by -1. To detect the collision between the object and the wall, you have to compare the two objects' x- and y-positions.