# Tweening a MovieClip

**URL:** <https://forum.kirupa.com/t/tweening-a-movieclip/330228>\
**Category:** flash\
**Created:** [December 15, 2012, 4:04pm UTC](https://forum.kirupa.com/t/tweening-a-movieclip/330228 "2012-12-15T16:04:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![LilyAirheart](https://avatars.discourse-cdn.com/v4/letter/l/ecae2f/32.png) [@LilyAirheart](https://forum.kirupa.com/u/LilyAirheart)\
**Post date:** [December 15, 2012, 4:04pm UTC](https://forum.kirupa.com/t/tweening-a-movieclip/330228/1 "2012-12-15T16:04:18Z")

</div>

Hello there!  
I’m not the most savvy person when it comes to programming, so please forgive me if this is a really silly question.  
I want to make a ball move across the stage, but you can create up to five points on the screen that the ball will go to first.  
So far I’ve been able to figure out how to get the coordinates defined, but getting the ball to move to them is driving me nuts! I’m trying to use the tween command but so far, no luck.

- 

import fl.transitions.Tween;  
import fl.transitions.easing.\*;  
import fl.transitions.TweenEvent;  
import flash.events.MouseEvent;  
import flash.display.MovieClip;

var count:Number = 0;  
var mark\_mc:Array = new Array();  
var xPosArray:Array = new Array();  
var yPosArray:Array = new Array();

stage.addEventListener(MouseEvent.CLICK, stagePoints);

function stagePoints(e:Event):void{  
count++;  
if(count \> 5){  
trace(“no more points please”);  
}

else{  
var waypoint:Waypoint = new Waypoint();  
addChild(waypoint);  
var xPos:Number;  
var yPos:Number;  
xPos = mouseX;  
yPos = mouseY;  
xPosArray.push(xPos);  
yPosArray.push(yPos);  
trace("xPosArray = " + xPosArray);  
trace("yPosArray = " + yPosArray);  
waypoint.x = xPos;  
waypoint.y = yPos;  
}

}

start\_btn.addEventListener(MouseEvent.CLICK, playCode);  
function playCode(e:MouseEvent):void{  
var ballTween:Tween = new Tween(ball\_mc, “x”, None.easeInOut, ball\_mc.x ,510, 10, true);

- 

Thanking you in advance.
