Actionscript 3 help? Animating Symbol Movement

Very new to AS3 and wondering if someone can help me with a small amount of code.
I currently have a movie clip that I wish to move ONLY vertically to 4 different positions depending on the button clicked.

I’ve got some code that works -
the name of the button in question as ‘Button4’ and the movie symbol called ‘Gasoline’, however, I was hoping to animate it to move at a visible rate to the desired location at the click of a mouse.
I can only seem to find tutorials where you ‘drag it’ or the button moves it until it goes off screen - not automatically to a desired point - and using the code snippets for animation only gives you a certain amount of area - I want this movie to move interchangeably between four points depending upon which button is clicked. Below is the code for the movie symbol to move from its initial position to button 4’s position - how can I code it to move at a certain speed rather than just ‘instantaneously appear’ -
Any help would be greatly appreciated.

Button4.addEventListener(MouseEvent.CLICK, fl_ClickToPosition_10);

function fl_ClickToPosition_10(event:MouseEvent):void

Gasoline.y = 310;


I think this is what you are looking for,

Here is my working example, please note that the code should be inside your button code !!!

  1. copy and these 3 lines at the top of your Actions Layer,
    import fl.transitions.Tween;
    import fl.transitions.easing.*;
    import fl.transitions.TweenEvent;

  2. First i created a Variable called D1L here,

var D1L:Tween = new Tween(D1, “x”, Strong.easeOut, 100, 200, 1, true);

  1. Then i created 2 buttons which i named L and R that control a movie clip called D1 movement.

The first code below shows controls for the left button with D1L that moves D1 from x: 100 to x: 200 in one second however, if you are using “y” axis, just chacnge x for y.

// this is the button code, in this case my button instance is L1.

L1.addEventListener(MouseEvent.CLICK, onClick);
function onClick(e:MouseEvent){

  1. I then created another Variable for the right button which moves D1 from the previous position back to its original position as follows,

var D1R:Tween = new Tween(D1, “x”, Strong.easeOut, 200, 100, 1, true);

// this is the button code, in this case my button instance is R1.

R1.addEventListener(MouseEvent.CLICK, onClick);
function onClick(e:MouseEvent){

Good luck and hope this helps however, if you have difficulties refer to the link above.